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.
This commit is contained in:
Ján Tomko 2012-08-27 14:51:28 +02:00 committed by Peter Krempa
parent 661d7fb4fc
commit 1fe6d219cb

View File

@ -3179,6 +3179,7 @@ error:
virSecurityLabelDefFree(def->seclabels[i - 1]);
}
VIR_FREE(def->seclabels);
def->nseclabels = 0;
VIR_FREE(list);
return -1;
}