[prev in list] [next in list] [prev in thread] [next in thread]
List: rockbox-cvs
Subject: DX 50: Fix file descriptor leak on error
From: gerrit () rockbox ! org
Date: 2014-12-20 14:05:06
Message-ID: 201412201405.sBKE56X0030776 () giant ! haxx ! se
[Download RAW message or body]
commit 1eb1bc24f2debaaaef31db2872c800bd4d98fcf4
Author: Thomas Jarosch <tomj@simonv.com>
Date: Sat Dec 20 14:59:19 2014 +0100
DX 50: Fix file descriptor leak on error
Unimportant change, still good style.
cppcheck reported:
[rockbox/firmware/target/hosted/android/dx50/button-dx50.c:92]: (error) Resource \
leak: fd [rockbox/firmware/target/hosted/android/dx50/button-dx50.c:98]: (error) \
Resource leak: fd
Change-Id: Ic1831382219c44e7bef71cb2391646c9910d2369
diff --git a/firmware/target/hosted/android/dx50/button-dx50.c \
b/firmware/target/hosted/android/dx50/button-dx50.c index 5ab58ce..250b448 100644
--- a/firmware/target/hosted/android/dx50/button-dx50.c
+++ b/firmware/target/hosted/android/dx50/button-dx50.c
@@ -89,12 +89,14 @@ static int open_device(const char *device, int print_flags)
new_ufds = realloc(ufds, sizeof(ufds[0]) * (nfds + 1));
if(new_ufds == NULL) {
fprintf(stderr, "out of memory\n");
+ close(fd);
return -1;
}
ufds = new_ufds;
new_device_names = realloc(device_names, sizeof(device_names[0]) * (nfds + 1));
if(new_device_names == NULL) {
fprintf(stderr, "out of memory\n");
+ close(fd);
return -1;
}
device_names = new_device_names;
_______________________________________________
rockbox-cvs mailing list
rockbox-cvs@cool.haxx.se
http://cool.haxx.se/cgi-bin/mailman/listinfo/rockbox-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic