summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2022-04-04 06:43:41 +0200
committerGravatar Nikias Bassen2022-04-04 06:43:41 +0200
commit0da2aa35f2bdfd5b06fc4564a46298a5d689c4fa (patch)
treea56fc8a5aa004e0d00eab9659e2218673b01bdac /src
parent17a2b964ca9c94f6615994ba2179bf4228e31236 (diff)
downloadlibimobiledevice-glue-0da2aa35f2bdfd5b06fc4564a46298a5d689c4fa.tar.gz
libimobiledevice-glue-0da2aa35f2bdfd5b06fc4564a46298a5d689c4fa.tar.bz2
utils: Close file if buffer allocation fails in buffer_read_from_filename()
Thanks @demhademha for pointing this out.
Diffstat (limited to 'src')
-rw-r--r--src/utils.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
index af12aa5..f3d7bdc 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -280,6 +280,7 @@ LIBIMOBILEDEVICE_GLUE_API int buffer_read_from_filename(const char *filename, ch
*buffer = (char*)malloc(sizeof(char)*(size+1));
if (*buffer == NULL) {
+ fclose(f);
return 0;
}