At Sun, 19 Jan 2014 16:22:47 +0400, Ivan Sorokin wrote:
On 19.01.2014 14:16, Ivan Sorokin wrote:
I tried to trace problem in snd_hctl_elem_tlv_read, but I failed to do so due to lack of experience with alsa-lib.
Could someone more experienced with alsa-lib look at the problem?
After a bit more investigation I've found that tlv is initialized in snd_ctl_hw_elem_tlv with memcpy in line 245. This initialization looks perfectly correct. So perhaps this is a error in valgrind (unimplemented ioctl).
P.S. I believe I found a memory leak:
switch (op_flag) { case -1: inum = SNDRV_CTL_IOCTL_TLV_COMMAND; break; case 0: inum = SNDRV_CTL_IOCTL_TLV_READ; break; case 1: inum = SNDRV_CTL_IOCTL_TLV_WRITE; break; default: return -EINVAL; } xtlv = malloc(sizeof(struct snd_ctl_tlv) + tlv_size); if (xtlv == NULL) return -ENOMEM; xtlv->numid = numid; xtlv->length = tlv_size; memcpy(xtlv->tlv, tlv, tlv_size); if (ioctl(hw->fd, inum, xtlv) < 0) { free(xtlv); return -errno; } if (op_flag == 0) { if (xtlv->tlv[1] + 2 * sizeof(unsigned int) > tlv_size)
missing free(xtlv) here
Good catch. Care to send a proper fix patch?
thanks,
Takashi
return -EFAULT; memcpy(tlv, xtlv->tlv, xtlv->tlv[1] + 2 * sizeof(unsigned int));
} free(xtlv); return 0;
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel