compress_open() should delay taking a copy of the
config struct until we've finished modifying it.
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
compress->config = calloc(1, sizeof(*config));
if (!compress->config)
goto input_fail;
- memcpy(compress->config, config, sizeof(*compress->config));
snprintf(fn, sizeof(fn), "/dev/snd/comprC%uD%u", card, device);
goto codec_fail;
}
#endif
+
+ memcpy(compress->config, config, sizeof(*compress->config));
fill_compress_params(config, ¶ms);
if (ioctl(compress->fd, SNDRV_COMPRESS_SET_PARAMS, ¶ms)) {