[PATCH] storage: plug memory leak on error

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

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]