mirror of https://gitee.com/openkylin/libvirt.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.
This commit is contained in:
parent
661d7fb4fc
commit
1fe6d219cb
|
@ -3179,6 +3179,7 @@ error:
|
|||
virSecurityLabelDefFree(def->seclabels[i - 1]);
|
||||
}
|
||||
VIR_FREE(def->seclabels);
|
||||
def->nseclabels = 0;
|
||||
VIR_FREE(list);
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue