aboutsummaryrefslogtreecommitdiff
path: root/lib/splay.c
diff options
context:
space:
mode:
authorJulien Chaffraix <julien.chaffraix@gmail.com>2010-05-25 06:53:48 -0700
committerDaniel Stenberg <daniel@haxx.se>2010-05-26 00:40:26 +0200
commit9e480973eb6175bcf7ddacb5c0356e3c16373253 (patch)
tree2ce436c38eb4270ed72731e5eac43203280979c0 /lib/splay.c
parent2e056353b00d0944bdb2f8e948cc40a4dc0f3dfb (diff)
OOM fixes in http_negociate.c and lib/splay.c
Fix 2 OOM errors: a missing NULL-check in lib/http_negociate.c and a potential NULL dereferencing in lib/splay.c
Diffstat (limited to 'lib/splay.c')
-rw-r--r--lib/splay.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/splay.c b/lib/splay.c
index db3dbeaf0..dcc42cf26 100644
--- a/lib/splay.c
+++ b/lib/splay.c
@@ -394,6 +394,10 @@ int main(int argc, argv_item_t argv[])
for (i = 0; i < MAX; i++) {
struct timeval key;
ptrs[i] = t = malloc(sizeof(struct Curl_tree));
+ if(!t) {
+ puts("out of memory!");
+ return 0;
+ }
key.tv_sec = 0;
#ifdef TEST2
@@ -405,10 +409,6 @@ int main(int argc, argv_item_t argv[])
#endif
t->payload = (void *)key.tv_usec; /* for simplicity */
- if(!t) {
- puts("out of memory!");
- return 0;
- }
root = Curl_splayinsert(key, root, t);
}