mirror of
https://github.com/sheumann/hush.git
synced 2024-12-23 05:29:58 +00:00
plug a DIR* leak on error path
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
8578196b76
commit
2272129a93
@ -29,14 +29,15 @@ static char *find_block_device_in_dir(struct arena *ap)
|
||||
char *retpath = NULL;
|
||||
int len, rem;
|
||||
|
||||
dir = opendir(ap->devpath);
|
||||
if (!dir)
|
||||
return NULL;
|
||||
|
||||
len = strlen(ap->devpath);
|
||||
rem = DEVNAME_MAX-2 - len;
|
||||
if (rem <= 0)
|
||||
return NULL;
|
||||
|
||||
dir = opendir(ap->devpath);
|
||||
if (!dir)
|
||||
return NULL;
|
||||
|
||||
ap->devpath[len++] = '/';
|
||||
|
||||
while ((entry = readdir(dir)) != NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user