From c97b9721722b367db18c56bd0901b7b63b509b70 Mon Sep 17 00:00:00 2001 From: Incont Date: Mon, 18 May 2015 18:37:48 +0300 Subject: [PATCH] fixed bug: Unable to load the empty file (closes #141) --- ios-deploy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios-deploy.c b/ios-deploy.c index 5f8abb4..d3c84b1 100644 --- a/ios-deploy.c +++ b/ios-deploy.c @@ -1268,7 +1268,7 @@ void* read_file_to_memory(char * path, size_t* file_size) *file_size = buf.st_size; FILE* fd = fopen(path, "r"); char* content = malloc(*file_size); - if (fread(content, *file_size, 1, fd) != 1) + if (*file_size != 0 && fread(content, *file_size, 1, fd) != 1) { fclose(fd); return NULL;