setup_chmap() will return with error number if hw_map calloc fail or
channels doesn't match with hw_params, but memory free was ignored when
error occurs.
Signed-off-by: chunxu.li <chunxuxiao@gmail.com>
Reviewed-by: Takashi Sakamoto o-takashi@sakamocchi.jp
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
hw_map = calloc(hwparams.channels, sizeof(int));
if (!hw_map) {
error(_("not enough memory"));
+ free(hw_chmap);
return -1;
}
error(_("Channel %d doesn't match with hw_parmas"), ch);
snd_pcm_chmap_print(hw_chmap, sizeof(buf), buf);
fprintf(stderr, "hardware chmap = %s\n", buf);
+ free(hw_chmap);
return -1;
}
}