From: Jim Meyering Date: Tue, 16 Feb 2010 08:36:57 +0000 (+0100) Subject: tests: avoid NULL deref upon OOM failure X-Git-Tag: v0.7.7~145 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b78fddea39f7099766ed50efd04ceecb8b8fc857;p=thirdparty%2Flibvirt.git tests: avoid NULL deref upon OOM failure * tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Handle malloc failure. --- diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 3ee71a3b1b..aa42f996eb 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -98,7 +98,8 @@ static int testCompareXMLToArgvFiles(const char *xml, len += strlen(*tmp) + 1; tmp++; } - actualargv = malloc(sizeof(*actualargv)*len); + if ((actualargv = malloc(sizeof(*actualargv)*len)) == NULL) + goto fail; actualargv[0] = '\0'; tmp = qenv; while (*tmp) {