diff --git a/src/util/virconf.c b/src/util/virconf.c index 9952f3fee0a2bf46623b1cf0f60203d1629ab380..e882d150752cc813fdb56f56f6ef8543fad1148d 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; }