From: vanyacpp@gmail.com
To: patch@alsa-project.org
Cc: Ivan Sorokin <vanyacpp@gmail.com>, alsa-devel@alsa-project.org
Subject: [PATCH - my module 1/1] control_hw: fix potential memory leak
Date: Wed, 22 Jan 2014 00:12:50 +0400 [thread overview]
Message-ID: <52ded2de.463f700a.68c2.ffffb186@mx.google.com> (raw)
From: Ivan Sorokin <vanyacpp@gmail.com>
Signed-off-by: Ivan Sorokin <vanyacpp@gmail.com>
diff --git a/src/control/control_hw.c b/src/control/control_hw.c
index 148097f..dfc9dcd 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);
--
1.8.1.2
next reply other threads:[~2014-01-21 20:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-21 20:12 vanyacpp [this message]
2014-01-22 6:41 ` [PATCH - my module 1/1] control_hw: fix potential memory leak Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52ded2de.463f700a.68c2.ffffb186@mx.google.com \
--to=vanyacpp@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=patch@alsa-project.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.