summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorMansour Moufid <mansourmoufid@gmail.com>2011-05-27 18:40:31 -0400
committerNick Mathewson <nickm@torproject.org>2011-06-08 16:46:21 -0400
commit446cc7a0a1160f9214bef3b2d5140c2ddca9cee0 (patch)
tree8304ec14f63ad1d0332071359ca57207c251ccea /http.c
parent09fe97da3b0dcdb6ee172ff8e4f710e0baad2d1c (diff)
downloadlibevent-446cc7a0a1160f9214bef3b2d5140c2ddca9cee0.tar.gz
Check if the `evhttp_new_object' function in `http.c' returns NULL.
Diffstat (limited to 'http.c')
-rw-r--r--http.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/http.c b/http.c
index b97485f6..a2bc570f 100644
--- a/http.c
+++ b/http.c
@@ -3203,8 +3203,11 @@ evhttp_new_object(void)
struct evhttp *
evhttp_new(struct event_base *base)
{
- struct evhttp *http = evhttp_new_object();
+ struct evhttp *http = NULL;
+ http = evhttp_new_object();
+ if (http == NULL)
+ return (NULL);
http->base = base;
return (http);
@@ -3217,8 +3220,11 @@ evhttp_new(struct event_base *base)
struct evhttp *
evhttp_start(const char *address, unsigned short port)
{
- struct evhttp *http = evhttp_new_object();
+ struct evhttp *http = NULL;
+ http = evhttp_new_object();
+ if (http == NULL)
+ return (NULL);
if (evhttp_bind_socket(http, address, port) == -1) {
mm_free(http);
return (NULL);