mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 04:15:44 +01:00
alsactl: fix error path code in init_parse.c
If initialization file (-i option) does not exists, the free_space() function was called with NULL pointer. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
87ee474b1d
commit
1247c3d8ac
1 changed files with 12 additions and 8 deletions
|
@ -1747,10 +1747,12 @@ int init(const char *filename, const char *cardname)
|
||||||
}
|
}
|
||||||
first = 0;
|
first = 0;
|
||||||
err = init_space(&space, card);
|
err = init_space(&space, card);
|
||||||
if (err == 0 &&
|
if (err == 0) {
|
||||||
(space->rootdir = new_root_dir(filename)) != NULL)
|
space->rootdir = new_root_dir(filename);
|
||||||
|
if (space->rootdir != NULL)
|
||||||
err = parse(space, filename);
|
err = parse(space, filename);
|
||||||
free_space(space);
|
free_space(space);
|
||||||
|
}
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1762,11 +1764,13 @@ int init(const char *filename, const char *cardname)
|
||||||
}
|
}
|
||||||
memset(&space, 0, sizeof(space));
|
memset(&space, 0, sizeof(space));
|
||||||
err = init_space(&space, card);
|
err = init_space(&space, card);
|
||||||
if (err == 0 &&
|
if (err == 0) {
|
||||||
(space->rootdir = new_root_dir(filename)) != NULL)
|
space->rootdir = new_root_dir(filename);
|
||||||
|
if (space->rootdir != NULL)
|
||||||
err = parse(space, filename);
|
err = parse(space, filename);
|
||||||
free_space(space);
|
free_space(space);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
error:
|
error:
|
||||||
sysfs_cleanup();
|
sysfs_cleanup();
|
||||||
return err;
|
return err;
|
||||||
|
|
Loading…
Reference in a new issue