From 0da2aa35f2bdfd5b06fc4564a46298a5d689c4fa Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Mon, 4 Apr 2022 06:43:41 +0200 Subject: utils: Close file if buffer allocation fails in buffer_read_from_filename() Thanks @demhademha for pointing this out. --- src/utils.c | 1 + 1 file changed, 1 insertion(+) 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; } -- cgit v1.1-32-gdbae