Patchwork [28/35] fs-tests: integck: fix memory leak in dir_new

login
register
mail settings
Submitter Artem Bityutskiy
Date April 20, 2011, 10:19 a.m.
Message ID <1303294748-5492-29-git-send-email-dedekind1@gmail.com>
Download mbox | patch
Permalink /patch/92181/
State Accepted
Commit 5815fd7b82e096abdb97dcec3f6b015427bcb251
Headers show

Comments

Artem Bityutskiy - April 20, 2011, 10:19 a.m.
From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>

Do not initialize dir->name because add_dir_entry already does
this for us, so we leak the memory.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
 tests/fs-tests/integrity/integck.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

Patch

diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
index d2db320..666bc70 100644
--- a/tests/fs-tests/integrity/integck.c
+++ b/tests/fs-tests/integrity/integck.c
@@ -473,7 +473,6 @@  static int dir_new(struct dir_info *parent, const char *name)
 	free(path);
 
 	dir = zalloc(sizeof(struct dir_info));
-	dir->name = dup_string(name);
 	dir->parent = parent;
 	if (parent)
 		add_dir_entry(parent, 'd', name, dir);