Daniel Veillard wrote: > On Tue, Feb 02, 2010 at 08:00:59PM +0100, Jim Meyering wrote: >> The buffer allocated by VIR_ALLOC here is never used, and >> the sole pointer to it is overwritten by this stmt: >> >> source = &list->sources[list->nsources++]; >> >> >> >From 52cf50def236ab61298ebbba39fcaf89d440f4ec Mon Sep 17 00:00:00 2001 >> From: Jim Meyering <meyering@xxxxxxxxxx> >> Date: Tue, 2 Feb 2010 19:59:14 +0100 >> Subject: [PATCH] virStoragePoolSourceListNewSource: avoid unconditional leak >> >> * src/conf/storage_conf.c (virStoragePoolSourceListNewSource): >> Remove an unused (and leaked) allocation. >> --- >> src/conf/storage_conf.c | 6 ------ >> 1 files changed, 0 insertions(+), 6 deletions(-) >> >> diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c >> index bd34f5e..62b8394 100644 >> --- a/src/conf/storage_conf.c >> +++ b/src/conf/storage_conf.c >> @@ -1692,17 +1692,11 @@ virStoragePoolSourcePtr >> virStoragePoolSourceListNewSource(virConnectPtr conn, >> virStoragePoolSourceListPtr list) >> { >> virStoragePoolSourcePtr source; >> >> - if (VIR_ALLOC(source) < 0) { >> - virReportOOMError(conn); >> - return NULL; >> - } >> - >> if (VIR_REALLOC_N(list->sources, list->nsources+1) < 0) { >> - VIR_FREE(source); >> virReportOOMError(conn); >> return NULL; >> } >> >> source = &list->sources[list->nsources++]; > > good catch! ACK Thanks. I've pushed that and the other two you ACK'd. -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list