Browse Source

faux.ini: Additional checking for NULL ptr

Serj Kalichev 4 years ago
parent
commit
047a2a9f5e
1 changed files with 3 additions and 0 deletions
  1. 3 0
      faux/ini/ini.c

+ 3 - 0
faux/ini/ini.c

@@ -395,6 +395,9 @@ int faux_ini_parse_file(faux_ini_t *ini, const char *fn) {
 		return -1;
 
 	buf = faux_zmalloc(size);
+	assert(buf);
+	if (!buf)
+		goto error;
 	while (fgets(buf + bytes_readed, size - bytes_readed, fd)) {
 
 		// Not enough space in buffer. Make it larger.