render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
Blob Blame History Raw
From d1096d0e37014342aca0ffcb879eed62bf7a098e Mon Sep 17 00:00:00 2001
Message-Id: <d1096d0e37014342aca0ffcb879eed62bf7a098e@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 26 Feb 2014 14:55:32 +0100
Subject: [PATCH] storage: gluster: Don't leak private data when storage file
 init fails

https://bugzilla.redhat.com/show_bug.cgi?id=1032370

In a44b7b87bcc6681e2939f65a3552fc96f68bc7b6 I've introduced a function
that initializes a storage file wrapper object on gluster based volumes.

The initialization function leaks the private data pointer in case of
failure. This patch fixes it.

Reported by John Ferlan.

(cherry picked from commit ad95fa59572c99c26959e6808a1e779a4ffed6de)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/storage/storage_backend_gluster.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c
index f17ffea..01c5573 100644
--- a/src/storage/storage_backend_gluster.c
+++ b/src/storage/storage_backend_gluster.c
@@ -544,6 +544,7 @@ virStorageFileBackendGlusterInit(virStorageFilePtr file)
 error:
     VIR_FREE(priv->volname);
     glfs_fini(priv->vol);
+    VIR_FREE(priv);
 
     return -1;
 }
-- 
1.9.0