From 446cc7a0a1160f9214bef3b2d5140c2ddca9cee0 Mon Sep 17 00:00:00 2001 From: Mansour Moufid Date: Fri, 27 May 2011 18:40:31 -0400 Subject: Check if the `evhttp_new_object' function in `http.c' returns NULL. --- http.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'http.c') 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); -- cgit v1.2.1