diff options
author | Jim Meyering <meyering@redhat.com> | 2010-02-16 09:36:57 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2010-02-16 18:09:13 +0100 |
commit | b78fddea39f7099766ed50efd04ceecb8b8fc857 (patch) | |
tree | 854d191eb1054ec5da2523703394ff7a28d9c23c /tests | |
parent | qemuInitPasswords: avoid unconditional leak (diff) | |
download | libvirt-b78fddea39f7099766ed50efd04ceecb8b8fc857.tar.gz libvirt-b78fddea39f7099766ed50efd04ceecb8b8fc857.tar.bz2 libvirt-b78fddea39f7099766ed50efd04ceecb8b8fc857.zip |
tests: avoid NULL deref upon OOM failure
* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Handle malloc
failure.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qemuxml2argvtest.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 3ee71a3b1..aa42f996e 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) { |