summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Sorokin <vanyacpp@gmail.com>2014-01-22 00:12:50 +0400
committerTakashi Iwai <tiwai@suse.de>2014-01-22 07:40:46 +0100
commit336dc58beba0ca7cf5650dc12ed3eb72d61ac6d3 (patch)
tree4f27e4369f45a8257bde12d14660521434b9dbc9
parent3baf1bee843d8f0559f1481f26e9b8235b5e85ee (diff)
downloadalsa-lib-336dc58beba0ca7cf5650dc12ed3eb72d61ac6d3.tar.gz
control_hw: fix potential memory leak
Signed-off-by: Ivan Sorokin <vanyacpp@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--src/control/control_hw.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/control/control_hw.c b/src/control/control_hw.c
index 148097fa..dfc9dcd5 100644
--- a/src/control/control_hw.c
+++ b/src/control/control_hw.c
@@ -240,8 +240,10 @@ static int snd_ctl_hw_elem_tlv(snd_ctl_t *handle, int op_flag,
return -errno;
}
if (op_flag == 0) {
- if (xtlv->tlv[1] + 2 * sizeof(unsigned int) > tlv_size)
+ if (xtlv->tlv[1] + 2 * sizeof(unsigned int) > tlv_size) {
+ free(xtlv);
return -EFAULT;
+ }
memcpy(tlv, xtlv->tlv, xtlv->tlv[1] + 2 * sizeof(unsigned int));
}
free(xtlv);