[alsa-devel] [PATCH] alsa-lib: fixed coverity reported issues under "USE_AFTER_FREE" checker.

sudarshan.bisht at nokia.com sudarshan.bisht at nokia.com
Thu Mar 17 09:12:19 CET 2011


From: Sudarshan <sudarshan.bisht at nokia.com>

---
 src/control/control_hw.c |    1 +
 src/mixer/mixer.c        |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/control/control_hw.c b/src/control/control_hw.c
index cf258b4..a8463c1 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);
+		hw = NULL;
 	}
 	ctl->ops = &snd_ctl_hw_ops;
 	ctl->private_data = hw;
diff --git a/src/mixer/mixer.c b/src/mixer/mixer.c
index 85d843f..0f4f1ac 100644
--- a/src/mixer/mixer.c
+++ b/src/mixer/mixer.c
@@ -205,7 +205,7 @@ int snd_mixer_attach(snd_mixer_t *mixer, const char *name)
 		return err;
 	err = snd_mixer_attach_hctl(mixer, hctl);
 	if (err < 0) {
-		snd_hctl_close(hctl);
+		/* ideally hctl should be freed here, but it's taken care in snd_mixer_attach_hctl*/	
 		return err;
 	}
 	return 0;
-- 
1.7.0.4



More information about the Alsa-devel mailing list