From: Dwight Engen Date: Tue, 7 May 2013 14:57:38 +0000 (-0400) Subject: coverity: fix potential dereference NULL returned from malloc X-Git-Tag: lxc-1.0.0.alpha1~1^2~220 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd66e5adb38c76e6eecf0e54c5418fd9f7ac3b3b;p=thirdparty%2Flxc.git coverity: fix potential dereference NULL returned from malloc Signed-off-by: Dwight Engen Acked-by: Serge E. Hallyn --- diff --git a/src/lxc/network.c b/src/lxc/network.c index 93fc169c2..d1ccc0d3d 100644 --- a/src/lxc/network.c +++ b/src/lxc/network.c @@ -783,8 +783,11 @@ static int ifa_get_local_ip(int family, struct ip_req *ip_info, void** res) { /* We might have found an IFA_ADDRESS before, * which we now overwrite with an IFA_LOCAL. */ - if (!*res) + if (!*res) { *res = malloc(addrlen); + if (!*res) + return -1; + } memcpy(*res, RTA_DATA(rta), addrlen);