Commit 2fee22a9 authored by ssbssa's avatar ssbssa Committed by Tristan Matthews
Browse files

directory: fix memory leaks

Signed-off-by: default avatarTristan Matthews <>
parent 6cccd64d
......@@ -220,18 +220,23 @@ static bool directory_push (access_sys_t *p_sys, DIR *handle, char *psz_uri)
struct stat st;
if (fstat (dirfd (handle), &st))
goto error;
goto error_filev;
p_dir->device = st.st_dev;
p_dir->inode = st.st_ino;
p_dir->path = make_path (psz_uri);
if (p_dir->path == NULL)
goto error;
goto error_filev;
p_sys->current = p_dir;
return true;
for (int i = 0; i < p_dir->filec; i++)
free (p_dir->filev[i]);
free (p_dir->filev);
closedir (handle);
free (p_dir);
......@@ -249,6 +254,8 @@ static bool directory_pop (access_sys_t *p_sys)
p_sys->current = p_old->parent;
closedir (p_old->handle);
free (p_old->uri);
for (int i = 0; i < p_old->filec; i++)
free (p_old->filev[i]);
free (p_old->filev);
free (p_old->path);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment