From 6ca78cc09a2570fa08a768cc850dc18e5be2189a Mon Sep 17 00:00:00 2001 From: Davidlohr Bueso Date: Mon, 25 Jul 2011 17:12:52 -0700 Subject: [PATCH] --- yaml --- r: 258988 b: refs/heads/master c: 2a6d0ac182688d4d23357ece744978706c044aad h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/um/os-Linux/mem.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 46d5c36db3f0..44be7ade6751 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9a8beb93067764344523386e0e5388d3fd78add7 +refs/heads/master: 2a6d0ac182688d4d23357ece744978706c044aad diff --git a/trunk/arch/um/os-Linux/mem.c b/trunk/arch/um/os-Linux/mem.c index e696144d2be3..62878cf1d33f 100644 --- a/trunk/arch/um/os-Linux/mem.c +++ b/trunk/arch/um/os-Linux/mem.c @@ -176,7 +176,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); @@ -191,13 +191,15 @@ static int __init make_tempfile(const char *template, char **out_tempname, } if (do_unlink && (unlink(tempname) < 0)) { perror("unlink"); - goto out; + goto close; } if (out_tempname) { *out_tempname = tempname; } else free(tempname); return fd; +close: + close(fd); out: free(tempname); return -1;