mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-09 17:45:41 +01:00
topology: pre-processor: fix seg fault when there no command line defines
In case there are not command line definitions, there is nothing to merge or delete. Fixes: https://github.com/alsa-project/alsa-utils/pull/141 Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
b5748d329b
commit
ed36ce25a7
1 changed files with 14 additions and 11 deletions
|
@ -172,7 +172,8 @@ void free_pre_processor(struct tplg_pre_processor *tplg_pp)
|
||||||
snd_output_close(tplg_pp->output);
|
snd_output_close(tplg_pp->output);
|
||||||
snd_output_close(tplg_pp->dbg_output);
|
snd_output_close(tplg_pp->dbg_output);
|
||||||
snd_config_delete(tplg_pp->output_cfg);
|
snd_config_delete(tplg_pp->output_cfg);
|
||||||
snd_config_delete(tplg_pp->define_cfg);
|
if (tplg_pp->define_cfg)
|
||||||
|
snd_config_delete(tplg_pp->define_cfg);
|
||||||
free(tplg_pp->inc_path);
|
free(tplg_pp->inc_path);
|
||||||
free(tplg_pp);
|
free(tplg_pp);
|
||||||
}
|
}
|
||||||
|
@ -295,16 +296,18 @@ create:
|
||||||
* merge the command line defines with the variables in the conf file to override
|
* merge the command line defines with the variables in the conf file to override
|
||||||
* default values; use a copy (merge deletes the source tree)
|
* default values; use a copy (merge deletes the source tree)
|
||||||
*/
|
*/
|
||||||
ret = snd_config_copy(&conf_tmp, tplg_pp->define_cfg);
|
if (tplg_pp->define_cfg) {
|
||||||
if (ret < 0) {
|
ret = snd_config_copy(&conf_tmp, tplg_pp->define_cfg);
|
||||||
fprintf(stderr, "Failed to copy variable definitions\n");
|
if (ret < 0) {
|
||||||
return ret;
|
fprintf(stderr, "Failed to copy variable definitions\n");
|
||||||
}
|
return ret;
|
||||||
ret = snd_config_merge(tplg_pp->define_cfg_merged, conf_tmp, true);
|
}
|
||||||
if (ret < 0) {
|
ret = snd_config_merge(tplg_pp->define_cfg_merged, conf_tmp, true);
|
||||||
fprintf(stderr, "Failed to override variable definitions\n");
|
if (ret < 0) {
|
||||||
snd_config_delete(conf_tmp);
|
fprintf(stderr, "Failed to override variable definitions\n");
|
||||||
return ret;
|
snd_config_delete(conf_tmp);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue