ref: 90b26f032e7774460c97c7c0b0759563c7069462
parent: d7db2d63607d935cdf9f10db66ae32351e689a1e
author: Christopher Snowhill <kode54@gmail.com>
date: Mon Sep 11 16:59:28 EDT 2017
Add error checking to fopen call.
--- a/src/helpers/stdfile.c
+++ b/src/helpers/stdfile.c
@@ -36,6 +36,11 @@
dumb_stdfile * file = ( dumb_stdfile * ) malloc( sizeof(dumb_stdfile) );
if ( !file ) return 0;
file->file = fopen(filename, "rb");
+ if ( !file->file )
+ {
+ free( file );
+ return 0;
+ }
fseek(file->file, 0, SEEK_END);
file->size = ftell(file->file);
fseek(file->file, 0, SEEK_SET);