From 932fc3d353649266b0b515e94e6c3292f850d445 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 19 Feb 2015 04:21:08 +0100 Subject: [PATCH] read_generic_file - add early return if rom_buf is NULL --- file_ops.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/file_ops.c b/file_ops.c index 5bbc3a72dd..e477f3d044 100644 --- a/file_ops.c +++ b/file_ops.c @@ -121,6 +121,9 @@ static bool read_generic_file(const char *path, void **buf, ssize_t *len) if ((ret = fread(rom_buf, 1, _len, file)) < _len) RARCH_WARN("Didn't read whole file.\n"); + if (!rom_buf) + goto error; + *buf = rom_buf; /* Allow for easy reading of strings to be safe.