diff --git a/file_extract.c b/file_extract.c index d47558a546..e10d40bf97 100644 --- a/file_extract.c +++ b/file_extract.c @@ -158,15 +158,16 @@ static size_t zlib_file_size(void *handle) static void *zlib_file_open(const char *path) { - ssize_t ret; + size_t ret = -1; + bool read_from_file = false; zlib_file_data_t *data = (zlib_file_data_t*)calloc(1, sizeof(*data)); if (!data) return NULL; - ret = read_file(path, &data->data); + read_from_file = read_file(path, &data->data, &ret); - if (ret < 0) + if (!read_from_file || ret < 0) { RARCH_ERR("Failed to open archive: %s.\n", path); diff --git a/file_ops.c b/file_ops.c index b007c5856c..d41d813e3d 100644 --- a/file_ops.c +++ b/file_ops.c @@ -116,10 +116,7 @@ static bool read_generic_file(const char *path, void **buf, size_t *len) rom_buf = malloc(_len + 1); if (!rom_buf) - { - RARCH_ERR("Couldn't allocate memory.\n"); goto error; - } if ((ret = fread(rom_buf, 1, _len, file)) < _len) RARCH_WARN("Didn't read whole file.\n");