libselinux: free memory in error branch
In case the allocation for the filename fails, free the memory of the context. Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Acked-by: James Carter <jwcart2@gmail.com>
This commit is contained in:
parent
7e979b56fd
commit
8266fd9401
1 changed files with 3 additions and 1 deletions
|
@ -497,13 +497,15 @@ static int filespec_add(ino_t ino, const char *con, const char *file,
|
|||
goto oom_freefl;
|
||||
fl->file = strdup(file);
|
||||
if (!fl->file)
|
||||
goto oom_freefl;
|
||||
goto oom_freeflcon;
|
||||
fl->next = prevfl->next;
|
||||
prevfl->next = fl;
|
||||
|
||||
__pthread_mutex_unlock(&fl_mutex);
|
||||
return 0;
|
||||
|
||||
oom_freeflcon:
|
||||
free(fl->con);
|
||||
oom_freefl:
|
||||
free(fl);
|
||||
oom:
|
||||
|
|
Loading…
Reference in a new issue