diff util.c @ 1592:31effaadf877

Fix some memory errors (mostly leaks) identified by valgrind
author Michael Pavone <pavone@retrodev.com>
date Fri, 22 Jun 2018 23:10:27 -0700
parents 7121daaa48c2
children 137dbd05ceab
line wrap: on
line diff
--- a/util.c	Fri Jun 22 21:11:38 2018 -0700
+++ b/util.c	Fri Jun 22 23:10:27 2018 -0700
@@ -359,9 +359,11 @@
 	for (extidx = 0; extidx < num_exts; extidx++)
 	{
 		if (!strcasecmp(ext, ext_list[extidx])) {
+			free(ext);
 			return 1;
 		}
 	}
+	free(ext);
 	return 0;
 }
 
@@ -721,6 +723,7 @@
 	if (numret) {
 		*numret = pos;
 	}
+	closedir(d);
 	return ret;
 }