From 1fe6d219cbb6aa9befcf45e41775affd2b1f179d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Mon, 27 Aug 2012 14:51:28 +0200 Subject: [PATCH] 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. --- src/conf/domain_conf.c | 1 + 1 file changed, 1 insertion(+) 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; } -- GitLab