From: Ján Tomko Date: Mon, 27 Aug 2012 12:51:28 +0000 (+0200) Subject: conf: prevent NULL pointer access in virSecurityLabelDefsParseXML X-Git-Tag: v0.10.0~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1fe6d219cbb6aa9befcf45e41775affd2b1f179d;p=thirdparty%2Flibvirt.git conf: prevent NULL pointer access in virSecurityLabelDefsParseXML When checking for seclabels without security models, def->nseclabels is already set to n. In the case of an error def->seclabels is freed but nseclabels is left untouched. This leads to a segmentation fault when def is freed in virDomainDefParseXML. --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 82ccf4dc18..c02d6f8502 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3179,6 +3179,7 @@ error: virSecurityLabelDefFree(def->seclabels[i - 1]); } VIR_FREE(def->seclabels); + def->nseclabels = 0; VIR_FREE(list); return -1; }