[sheepdog] [PATCH] dog/vdi: fix memory leak in dog vdi command

Ruoyu liangry at ucweb.com
Tue Apr 22 10:28:34 CEST 2014


Signed-off-by: Ruoyu <liangry at ucweb.com>
---
 dog/vdi.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/dog/vdi.c b/dog/vdi.c
index db5fc58..1851a2a 100644
--- a/dog/vdi.c
+++ b/dog/vdi.c
@@ -790,6 +790,7 @@ static int vdi_object_map(int argc, char **argv)
 			   SD_INODE_SIZE);
 	if (ret != EXIT_SUCCESS) {
 		sd_err("FATAL: %s not found", vdiname);
+		free(inode);
 		return ret;
 	}
 
@@ -1750,10 +1751,13 @@ static int vdi_check(int argc, char **argv)
 			   SD_INODE_SIZE);
 	if (ret != EXIT_SUCCESS) {
 		sd_err("FATAL: no inode objects");
-		return ret;
+		goto out;
 	}
 
-	return do_vdi_check(inode);
+	ret = do_vdi_check(inode);
+out:
+	free(inode);
+	return ret;
 }
 
 /* vdi backup format */
-- 
1.8.3.2





More information about the sheepdog mailing list