lib/loopdev: fix possible dir leak on error
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
06ae069bc3
commit
2e566efda3
1 changed files with 1 additions and 0 deletions
|
@ -427,6 +427,7 @@ static int loop_scandir(const char *dirname, int **ary, int hasprefix)
|
|||
tmp = realloc(*ary, arylen * sizeof(int));
|
||||
if (!tmp) {
|
||||
free(*ary);
|
||||
closedir(dir);
|
||||
return -1;
|
||||
}
|
||||
*ary = tmp;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue