alsa/0032-src-pcm-pcm_rate.c-add-missing-free.patch
Ismail Dönmez b35a2527db Accepting request 85033 from home:tiwai:branches:multimedia:libs
- backport upstream fixes: fix noresample hw_params rule and a few
  fixes for missing free()

OBS-URL: https://build.opensuse.org/request/show/85033
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=95
2011-09-27 11:08:17 +00:00

53 lines
1.4 KiB
Diff

From 2a7f653b7f3bea6c8f0895f1921c2d706f40684f Mon Sep 17 00:00:00 2001
From: Julia Lawall <julia@diku.dk>
Date: Sun, 18 Sep 2011 22:04:34 +0200
Subject: [PATCH 2/5] src/pcm/pcm_rate.c: add missing free
Something that is allocated using calloc is not freed on one
or more error paths.
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Suman Saha <sumsaha@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/pcm/pcm_rate.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
index 70e30e5..eb35e4a 100644
--- a/src/pcm/pcm_rate.c
+++ b/src/pcm/pcm_rate.c
@@ -1392,11 +1392,13 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
} else {
SNDERR("Invalid type for rate converter");
snd_pcm_close(pcm);
+ free(rate);
return -EINVAL;
}
if (err < 0) {
SNDERR("Cannot find rate converter");
snd_pcm_close(pcm);
+ free(rate);
return -ENOENT;
}
#else
@@ -1405,6 +1407,7 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
err = open_func(SND_PCM_RATE_PLUGIN_VERSION, &rate->obj, &rate->ops);
if (err < 0) {
snd_pcm_close(pcm);
+ free(rate);
return err;
}
#endif
@@ -1413,6 +1416,7 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
! rate->ops.input_frames || ! rate->ops.output_frames) {
SNDERR("Inproper rate plugin %s initialization", type);
snd_pcm_close(pcm);
+ free(rate);
return err;
}
--
1.7.6.1