Skip to contentSkip to conversation

uml: fix memory leak in arch/um/os-Linux/mem.c

PATCH In review Alexander Beregalov 2 participants 2 messages Jan 9, 2010 – Jan 10, 2010 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uml: fix memory leak in arch/um/os-Linux/mem.c

Free tempname before exit.
Found by cppcheck.

---
 arch/um/os-Linux/mem.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/um/os-Linux/mem.c +1 -1
index 93a11d7..f079ea0 100644
@@ -175,7 +175,7 @@ static int __init make_tempfile(const char *template, char **out_tempname,
 
 	find_tempdir();
 	if ((tempdir == NULL) || (strlen(tempdir) >= MAXPATHLEN))
-		return -1;
+		goto out;
 
 	if (template[0] != '/')
 		strcpy(tempname, tempdir);
Signature · 1 line
1.6.6
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Alexander Beregalov

Free tempname before exit.
Found by cppcheck.

Thanks!

Quoted 25 lines

---
arch/um/os-Linux/mem.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
arch/um/os-Linux/mem.c +1 -1
index 93a11d7..f079ea0 100644
@@ -175,7 +175,7 @@ static int __init make_tempfile(const char *template, char **out_tempname,
 
 	find_tempdir();
 	if ((tempdir == NULL) || (strlen(tempdir) >= MAXPATHLEN))
-		return -1;
+		goto out;
 
 	if (template[0] != '/')
 		strcpy(tempname, tempdir);
Signature · 7 lines
1.6.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Signature · 1 line
Live like a child, think like the god.