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

[libvirt] [PATCH] storage: plug memory leak on error



Detected by Coverity.  Present since commit 82c1740.

* src/storage/storage_backend_logical.c
(virStorageBackendLogicalMakeVol): Fix leak.
---

Pushing under the trivial rule.

 src/storage/storage_backend_logical.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index 51624a7..50d0407 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -231,16 +231,17 @@ virStorageBackendLogicalMakeVol(virStoragePoolObjPtr pool,
         if (!(offset_str = strndup(p + vars[j + 1].rm_so, len))) {
             virReportOOMError();
             goto cleanup;
         }

         if (virStrToLong_ull(offset_str, NULL, 10, &offset) < 0) {
             virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                   _("malformed volume extent offset value"));
+            VIR_FREE(offset_str);
             goto cleanup;
         }

         VIR_FREE(offset_str);

         vol->source.extents[vol->source.nextent].start = offset * size;
         vol->source.extents[vol->source.nextent].end = (offset * size) + length;
         vol->source.nextent++;
-- 
1.7.4.4


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