daemon: handle malloc() failure

This commit is contained in:
Nedko Arnaudov 2009-12-12 17:12:03 +02:00
parent e5fe8dbc99
commit 5324f63eff
1 changed files with 7 additions and 0 deletions

View File

@ -439,6 +439,13 @@ bool studios_iterate(void * call_ptr, void * context, bool (* callback)(void * c
free(path);
name = malloc(len - 4 + 1);
if (name == NULL)
{
log_error("malloc() failed.");
closedir(dir);
return false;
}
name[unescape(dentry->d_name, len - 4, name)] = 0;
//log_info("name = '%s'", name);