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

[Libguestfs] [PATCH] ext2: fix small memory leak on error



When failing to read the output of `readlink -f`, free the memory buffer
used for it.
---
 src/ext2fs-c.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/ext2fs-c.c b/src/ext2fs-c.c
index 9e0770a..f3ca7dc 100644
--- a/src/ext2fs-c.c
+++ b/src/ext2fs-c.c
@@ -631,6 +631,7 @@ ext2_copy_file (struct ext2_data *data, const char *src, const char *dest)
       }
       if (fgets (new_dirname, PATH_MAX, fp) == NULL) {
 	pclose (fp);
+	free (new_dirname);
 	goto cont;
       }
       pclose (fp);
-- 
1.9.3


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