* [PATCH 3/3 v5] alsa-lib: fixed coverity reported issues under "USE_AFTER_FREE" checker.
@ 2011-04-04 11:32 sudarshan.bisht
0 siblings, 0 replies; only message in thread
From: sudarshan.bisht @ 2011-04-04 11:32 UTC (permalink / raw)
To: alsa-devel
From: Sudarshan Bisht <sudarshan.bisht@nokia.com>
Coverity Static Analysis helps developers find hard-to-spot,
yet potentially crash-causing defects early in the development phase,
reducing the cost,time, and risk of software errors.
This patch has a fix for conditions where 1) variable is used
evern after getting freed thus causing junk assignment and 2) double
free of memory.
---
modules/mixer/simple/python.c | 1 +
src/control/control_hw.c | 1 +
src/mixer/mixer.c | 1 -
3 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/modules/mixer/simple/python.c b/modules/mixer/simple/python.c
index c822c52..784d9a0 100644
--- a/modules/mixer/simple/python.c
+++ b/modules/mixer/simple/python.c
@@ -663,6 +663,7 @@ pymixer_attach_hctl(struct pymixer *pymixer, PyObject *args)
return NULL;
err = snd_mixer_attach_hctl(pymixer->mixer, hctl);
if (err < 0) {
+ snd_hctl_close(hctl);
PyErr_Format(PyExc_RuntimeError, "Cannot attach hctl: %s", snd_strerror(err));
return NULL;
}
diff --git a/src/control/control_hw.c b/src/control/control_hw.c
index cf258b4..16c4987 100644
--- a/src/control/control_hw.c
+++ b/src/control/control_hw.c
@@ -414,6 +414,7 @@ int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode)
if (err < 0) {
close(fd);
free(hw);
+ return err;
}
ctl->ops = &snd_ctl_hw_ops;
ctl->private_data = hw;
diff --git a/src/mixer/mixer.c b/src/mixer/mixer.c
index 85d843f..5e5789a 100644
--- a/src/mixer/mixer.c
+++ b/src/mixer/mixer.c
@@ -228,7 +228,6 @@ int snd_mixer_attach_hctl(snd_mixer_t *mixer, snd_hctl_t *hctl)
return -ENOMEM;
err = snd_hctl_nonblock(hctl, 1);
if (err < 0) {
- snd_hctl_close(hctl);
free(slave);
return err;
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2011-04-04 11:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-04 11:32 [PATCH 3/3 v5] alsa-lib: fixed coverity reported issues under "USE_AFTER_FREE" checker sudarshan.bisht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).