A bug similar to the one fixed in the previous patch for the alsa
writer is also present in the oss writer: If oss_init() fails the
->private_data pointer is non-NULL, but its contents have already
been freed. glibc detects this, aborts the process and spits out
*** glibc detected *** ./para_write: double free or corruption (fasttop): 0x080622a0 ***
Fix this bug by initializing ->private_data only if oss_init()
succeeds.
struct oss_write_args_info *conf = wn->conf;
struct private_oss_write_data *powd = para_calloc(sizeof(*powd));
- wn->private_data = powd;
PARA_INFO_LOG("opening %s\n", conf->device_arg);
ret = para_open(conf->device_arg, O_WRONLY, 0);
if (ret < 0)
sample_rate);
}
wn->min_iqs = powd->bytes_per_frame;
+ wn->private_data = powd;
return 1;
err:
close(powd->fd);