diff --git a/src/util/virconf.c b/src/util/virconf.c index 9952f3fee0..e882d15075 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -589,7 +589,10 @@ virConfParseComment(virConfParserCtxtPtr ctxt) while ((ctxt->cur < ctxt->end) && (!IS_EOL(CUR))) NEXT; if (VIR_STRNDUP(comm, base, ctxt->cur - base) < 0) return -1; - virConfAddEntry(ctxt->conf, NULL, NULL, comm); + if (virConfAddEntry(ctxt->conf, NULL, NULL, comm) == NULL) { + VIR_FREE(comm); + return -1; + } return 0; }