uml: drivers/net_user.c memory leak fix
authorVitaliy Ivanov <vitalivanov@gmail.com>
Tue, 26 Jul 2011 00:12:49 +0000 (17:12 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 26 Jul 2011 03:57:12 +0000 (20:57 -0700)
Perform memory cleanup on exit.  On receiving invalid 'pid' we still
should clean 'output' variable.

Signed-off-by: Vitaliy Ivanov <vitalivanov@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/um/drivers/net_user.c

index 9415dd9e63ef1e98c15505733c3ba1c1eff02029..520118888f163755fce86c802f55b1ac2c83c8a5 100644 (file)
@@ -228,7 +228,10 @@ static void change(char *dev, char *what, unsigned char *addr,
                       "buffer\n");
 
        pid = change_tramp(argv, output, output_len);
-       if (pid < 0) return;
+       if (pid < 0) {
+               kfree(output);
+               return;
+       }
 
        if (output != NULL) {
                printk("%s", output);