[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] virStoragePoolSourceListNewSource: avoid unconditional leak



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 redhat com>
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++];
--
1.7.0.rc1.149.g0b0b7


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]