Skip to contentSkip to conversation

coverity fix in alsa-libs

PATCH Renu Tyagi 1 participant 1 message Sep 19, 2014

lore
Share & tools
lore

Renu Tyagi

author
#0 lore raw

From 14668184bf5489a0a8398ba51a1a130654cb7d82 Mon Sep 17 00:00:00 2001
From: renu tyagi <[email protected]>
Date: Fri, 19 Sep 2014 12:59:23 +0530
Subject: [PATCH] [pcm_file] : fixed missing free before return in case of error

---
 src/pcm/pcm_file.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
src/pcm/pcm_file.c +2 -0
index a0b8bf4..f6d222f 100644
@@ -758,6 +758,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
                ifd = open(ifname, O_RDONLY);   /* TODO: mind blocking mode */
                if (ifd < 0) {
                        SYSERR("open %s for reading failed", ifname);
+                       free(file->fname);
                        free(file);
                        return -errno;
                }
@@ -772,6 +773,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
        err = snd_pcm_new(&pcm, SND_PCM_TYPE_FILE, name, slave->stream, slave->mode);
        if (err < 0) {
                free(file->fname);
+               free(file->ifname);
                free(file);
                return err;
        }

--
1.7.1

From 14668184bf5489a0a8398ba51a1a130654cb7d82 Mon Sep 17 00:00:00 2001
From: renu tyagi <[email protected]>
Date: Fri, 19 Sep 2014 12:59:23 +0530
Subject: [PATCH] [pcm_file] : fixed missing free before return in case of error

---
 src/pcm/pcm_file.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
src/pcm/pcm_file.c +2 -0
index a0b8bf4..f6d222f 100644
@@ -758,6 +758,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
 		ifd = open(ifname, O_RDONLY);	/* TODO: mind blocking mode */
 		if (ifd < 0) {
 			SYSERR("open %s for reading failed", ifname);
+			free(file->fname);
 			free(file);
 			return -errno;
 		}
@@ -772,6 +773,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
 	err = snd_pcm_new(&pcm, SND_PCM_TYPE_FILE, name, slave->stream, slave->mode);
 	if (err < 0) {
 		free(file->fname);
+		free(file->ifname);
 		free(file);
 		return err;
 	}
Signature · 1 line
1.7.1