Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
4250637e
Commit
4250637e
authored
21 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
improved the cleaning up of memory when we fail to resolve names due to
out of memory (thanks to 'runtests.pl -t')
parent
08d1da10
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/hash.c
+1
-1
1 addition, 1 deletion
lib/hash.c
lib/hostip.c
+6
-5
6 additions, 5 deletions
lib/hostip.c
with
7 additions
and
6 deletions
lib/hash.c
+
1
−
1
View file @
4250637e
...
...
@@ -164,7 +164,7 @@ Curl_hash_add(curl_hash *h, char *key, size_t key_len, void *p)
/* couldn't insert it, destroy the 'he' element again */
hash_element_dtor
(
h
,
he
);
}
h
->
dtor
(
p
);
/* remove the NEW entry */
return
NULL
;
/* failure */
}
...
...
This diff is collapsed.
Click to expand it.
lib/hostip.c
+
6
−
5
View file @
4250637e
...
...
@@ -314,6 +314,7 @@ Curl_cache_addr(struct SessionHandle *data,
char
*
entry_id
;
size_t
entry_len
;
struct
Curl_dns_entry
*
dns
;
struct
Curl_dns_entry
*
dns2
;
time_t
now
;
/* Create an entry id, based upon the hostname and port */
...
...
@@ -325,7 +326,6 @@ Curl_cache_addr(struct SessionHandle *data,
/* Create a new cache entry */
dns
=
(
struct
Curl_dns_entry
*
)
malloc
(
sizeof
(
struct
Curl_dns_entry
));
if
(
!
dns
)
{
Curl_freeaddrinfo
(
addr
);
free
(
entry_id
);
return
NULL
;
}
...
...
@@ -336,14 +336,15 @@ Curl_cache_addr(struct SessionHandle *data,
/* Store the resolved data in our DNS cache. This function may return a
pointer to an existing struct already present in the hash, and it may
return the same argument we pass in. Make no assumptions. */
dns
=
Curl_hash_add
(
data
->
hostcache
,
entry_id
,
entry_len
+
1
,
(
void
*
)
dns
);
if
(
!
dns
)
{
/* Major badness, run away.
When this happens, the 'dns' data has
already been cleared up by Curl_hash_add(). */
dns
2
=
Curl_hash_add
(
data
->
hostcache
,
entry_id
,
entry_len
+
1
,
(
void
*
)
dns
);
if
(
!
dns
2
)
{
/* Major badness, run away.
*/
free
(
dns
);
free
(
entry_id
);
return
NULL
;
}
time
(
&
now
);
dns
=
dns2
;
dns
->
timestamp
=
now
;
/* used now */
dns
->
inuse
++
;
/* mark entry as in-use */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment