Don't leak dir on error path.
This commit is contained in:
parent
7fab839c75
commit
541dba3a78
|
@ -45,13 +45,16 @@ void * FsReadFirst(const char * path, FsEntry * entry) {
|
|||
return NULL;
|
||||
|
||||
tmp = opendir(path);
|
||||
if (!tmp)
|
||||
if (!tmp) {
|
||||
free(dir);
|
||||
return NULL;
|
||||
}
|
||||
dir->dir = tmp;
|
||||
|
||||
e = readdir(tmp);
|
||||
if (!e) {
|
||||
closedir(tmp);
|
||||
free(dir);
|
||||
return NULL;
|
||||
}
|
||||
strcpy(entry->cFileName, e->d_name);
|
||||
|
|
Loading…
Reference in New Issue