Mercurial > repos > blastem
comparison 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 |
comparison
equal
deleted
inserted
replaced
1591:5cfc7e4a207e | 1592:31effaadf877 |
---|---|
357 } | 357 } |
358 uint32_t extidx; | 358 uint32_t extidx; |
359 for (extidx = 0; extidx < num_exts; extidx++) | 359 for (extidx = 0; extidx < num_exts; extidx++) |
360 { | 360 { |
361 if (!strcasecmp(ext, ext_list[extidx])) { | 361 if (!strcasecmp(ext, ext_list[extidx])) { |
362 free(ext); | |
362 return 1; | 363 return 1; |
363 } | 364 } |
364 } | 365 } |
366 free(ext); | |
365 return 0; | 367 return 0; |
366 } | 368 } |
367 | 369 |
368 char * path_dirname(const char *path) | 370 char * path_dirname(const char *path) |
369 { | 371 { |
719 ret[pos++].is_dir = entry->d_type == DT_DIR; | 721 ret[pos++].is_dir = entry->d_type == DT_DIR; |
720 } | 722 } |
721 if (numret) { | 723 if (numret) { |
722 *numret = pos; | 724 *numret = pos; |
723 } | 725 } |
726 closedir(d); | |
724 return ret; | 727 return ret; |
725 } | 728 } |
726 | 729 |
727 time_t get_modification_time(char *path) | 730 time_t get_modification_time(char *path) |
728 { | 731 { |