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
02fc7bb5
Commit
02fc7bb5
authored
16 years ago
by
Yang Tse
Browse files
Options
Downloads
Patches
Plain Diff
fix OOM handling
parent
9e1294e8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/libtest/lib558.c
+23
-8
23 additions, 8 deletions
tests/libtest/lib558.c
with
23 additions
and
8 deletions
tests/libtest/lib558.c
+
23
−
8
View file @
02fc7bb5
...
...
@@ -77,8 +77,9 @@ static Curl_addrinfo *fake_ai(void)
int
test
(
char
*
URL
)
{
CURL
*
easyh
;
struct
curl_hash
*
hp
;
CURL
*
easyh
=
NULL
;
struct
curl_hash
*
hp
=
NULL
;
int
result
=
0
;
if
(
!
strcmp
(
URL
,
"check"
))
{
/* test harness script verifying if this test can run */
...
...
@@ -88,7 +89,8 @@ int test(char *URL)
easyh
=
curl_easy_init
();
if
(
!
easyh
)
{
fprintf
(
stdout
,
"easy handle init failed
\n
"
);
return
TEST_ERR_MAJOR_BAD
;
result
=
TEST_ERR_MAJOR_BAD
;
goto
cleanup
;
}
fprintf
(
stdout
,
"easy handle init OK
\n
"
);
...
...
@@ -96,7 +98,8 @@ int test(char *URL)
hp
=
Curl_mk_dnscache
();
if
(
!
hp
)
{
fprintf
(
stdout
,
"hash creation failed
\n
"
);
return
TEST_ERR_MAJOR_BAD
;
result
=
TEST_ERR_MAJOR_BAD
;
goto
cleanup
;
}
fprintf
(
stdout
,
"hash creation OK
\n
"
);
...
...
@@ -111,26 +114,36 @@ int test(char *URL)
data_key
=
aprintf
(
"%s:%d"
,
"dummy"
,
0
);
if
(
!
data_key
)
{
fprintf
(
stdout
,
"data key creation failed
\n
"
);
return
TEST_ERR_MAJOR_BAD
;
result
=
TEST_ERR_MAJOR_BAD
;
goto
cleanup
;
}
key_len
=
strlen
(
data_key
);
data_node
=
calloc
(
1
,
sizeof
(
struct
Curl_dns_entry
));
if
(
!
data_node
)
{
fprintf
(
stdout
,
"data node creation failed
\n
"
);
return
TEST_ERR_MAJOR_BAD
;
result
=
TEST_ERR_MAJOR_BAD
;
free
(
data_key
);
goto
cleanup
;
}
data_node
->
addr
=
fake_ai
();
if
(
!
data_node
->
addr
)
{
fprintf
(
stdout
,
"actual data creation failed
\n
"
);
return
TEST_ERR_MAJOR_BAD
;
result
=
TEST_ERR_MAJOR_BAD
;
free
(
data_node
);
free
(
data_key
);
goto
cleanup
;
}
nodep
=
Curl_hash_add
(
hp
,
data_key
,
key_len
+
1
,
(
void
*
)
data_node
);
if
(
!
nodep
)
{
fprintf
(
stdout
,
"insertion into hash failed
\n
"
);
return
TEST_ERR_MAJOR_BAD
;
result
=
TEST_ERR_MAJOR_BAD
;
Curl_freeaddrinfo
(
data_node
->
addr
);
free
(
data_node
);
free
(
data_key
);
goto
cleanup
;
}
free
(
data_key
);
...
...
@@ -138,6 +151,8 @@ int test(char *URL)
#endif
/* LIB559 */
/**/
cleanup:
fprintf
(
stdout
,
"destroying hash...
\n
"
);
Curl_hash_destroy
(
hp
);
fprintf
(
stdout
,
"hash destruction OK
\n
"
);
...
...
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