summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Jarosch <tomj@simonv.com>2014-12-20 14:59:19 +0100
committerThomas Jarosch <tomj@simonv.com>2014-12-20 14:59:19 +0100
commit1eb1bc24f2debaaaef31db2872c800bd4d98fcf4 (patch)
treeb20a5f6bac74e055e0ff6f229b6f09e0d5bc3450
parent575ec8902e61ea82bbe8639c1f5a29997b88dd8c (diff)
downloadrockbox-1eb1bc2.tar.gz
rockbox-1eb1bc2.zip
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
-rw-r--r--firmware/target/hosted/android/dx50/button-dx50.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/firmware/target/hosted/android/dx50/button-dx50.c b/firmware/target/hosted/android/dx50/button-dx50.c
index 5ab58ce420..250b448491 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;