mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-12-23 03:46:31 +01:00
alsactl init - fix memory leaks (valgrind helped)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
2e7bb3caf5
commit
cdf5a9b824
2 changed files with 6 additions and 1 deletions
|
@ -174,5 +174,6 @@ int main(int argc, char *argv[])
|
||||||
res = -ENODEV;
|
res = -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snd_config_update_free_global();
|
||||||
return res < 0 ? res : 0;
|
return res < 0 ? res : 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,13 +124,16 @@ static void free_space(struct space *space)
|
||||||
space->ctl_card_info = NULL;
|
space->ctl_card_info = NULL;
|
||||||
}
|
}
|
||||||
if (space->ctl_handle) {
|
if (space->ctl_handle) {
|
||||||
free(space->ctl_handle);
|
snd_hctl_close(space->ctl_handle);
|
||||||
space->ctl_handle = NULL;
|
space->ctl_handle = NULL;
|
||||||
}
|
}
|
||||||
if (space->rootdir)
|
if (space->rootdir)
|
||||||
free(space->rootdir);
|
free(space->rootdir);
|
||||||
if (space->program_result)
|
if (space->program_result)
|
||||||
free(space->program_result);
|
free(space->program_result);
|
||||||
|
if (space->go_to)
|
||||||
|
free(space->go_to);
|
||||||
|
free(space);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pair *value_find(struct space *space, const char *key)
|
struct pair *value_find(struct space *space, const char *key)
|
||||||
|
@ -1680,6 +1683,7 @@ static int parse(struct space *space, const char *filename)
|
||||||
linenum += linenum_adj;
|
linenum += linenum_adj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(line);
|
||||||
space->filename = NULL;
|
space->filename = NULL;
|
||||||
space->linenum = -1;
|
space->linenum = -1;
|
||||||
file_unmap(buf, bufsize);
|
file_unmap(buf, bufsize);
|
||||||
|
|
Loading…
Reference in a new issue