mirror of
https://github.com/sheumann/hush.git
synced 2025-01-10 16:29:44 +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;
|
char *retpath = NULL;
|
||||||
int len, rem;
|
int len, rem;
|
||||||
|
|
||||||
dir = opendir(ap->devpath);
|
|
||||||
if (!dir)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
len = strlen(ap->devpath);
|
len = strlen(ap->devpath);
|
||||||
rem = DEVNAME_MAX-2 - len;
|
rem = DEVNAME_MAX-2 - len;
|
||||||
if (rem <= 0)
|
if (rem <= 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
dir = opendir(ap->devpath);
|
||||||
|
if (!dir)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
ap->devpath[len++] = '/';
|
ap->devpath[len++] = '/';
|
||||||
|
|
||||||
while ((entry = readdir(dir)) != NULL) {
|
while ((entry = readdir(dir)) != NULL) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user