Don't leak dir on error path.

This commit is contained in:
riccardom 2010-08-15 14:06:39 +00:00
parent 7fab839c75
commit 541dba3a78
1 changed files with 4 additions and 1 deletions

View File

@ -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);