Accepting request 644181 from home:tiwai:branches:multimedia:libs

- Backport upstream commits:
  fix memory leaks and other minor issues in usb_stream plugin,
  fix a regression (appearins in PulseAudio) with a52 plugin:
  0001-pcm_usb_stream-fix-another-leak-in-snd_pcm_us_open.patch
  0002-pcm_usb_stream-remove-unused-parameter-in-snd_pcm_us.patch
  0003-pcm_usb_stream-fix-signess-issues.patch
  0004-a52_close-set-slave-to-NULL-to-avoid-double-pcm-free.patch

OBS-URL: https://build.opensuse.org/request/show/644181
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-plugins?expand=0&rev=112
This commit is contained in:
Ismail Dönmez
2018-10-24 07:59:46 +00:00
committed by Git OBS Bridge
parent 229b81254d
commit 911d3d50bb
6 changed files with 162 additions and 0 deletions
+11
View File
@@ -1,3 +1,14 @@
-------------------------------------------------------------------
Wed Oct 24 09:43:57 CEST 2018 - tiwai@suse.de
- Backport upstream commits:
fix memory leaks and other minor issues in usb_stream plugin,
fix a regression (appearins in PulseAudio) with a52 plugin:
0001-pcm_usb_stream-fix-another-leak-in-snd_pcm_us_open.patch
0002-pcm_usb_stream-remove-unused-parameter-in-snd_pcm_us.patch
0003-pcm_usb_stream-fix-signess-issues.patch
0004-a52_close-set-slave-to-NULL-to-avoid-double-pcm-free.patch
-------------------------------------------------------------------
Wed Oct 17 11:37:20 CEST 2018 - tiwai@suse.de
+8
View File
@@ -34,6 +34,10 @@ Source: ftp://ftp.alsa-project.org/pub/plugins/alsa-plugins-%{package_ve
Source1: asound-pulse.conf
Source2: alsa-pulse.conf
Source3: baselibs.conf
Patch1: 0001-pcm_usb_stream-fix-another-leak-in-snd_pcm_us_open.patch
Patch2: 0002-pcm_usb_stream-remove-unused-parameter-in-snd_pcm_us.patch
Patch3: 0003-pcm_usb_stream-fix-signess-issues.patch
Patch4: 0004-a52_close-set-slave-to-NULL-to-avoid-double-pcm-free.patch
BuildRequires: alsa-devel
BuildRequires: dbus-1-devel
%if %build_avcodec
@@ -144,6 +148,10 @@ library using libavcodec.
%prep
%setup -q -n %{name}-%{package_version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
export AUTOMAKE_JOBS="%{?_smp_mflags}"
@@ -0,0 +1,29 @@
From 68c4cd3a471ed1f4a367830eb31881d3e5815813 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Tue, 23 Oct 2018 08:39:16 +0200
Subject: [PATCH 1/4] pcm_usb_stream: fix another leak in snd_pcm_us_open()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
usb_stream/pcm_usb_stream.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/usb_stream/pcm_usb_stream.c b/usb_stream/pcm_usb_stream.c
index eb4ca981c5f1..5ca1c0f0d04e 100644
--- a/usb_stream/pcm_usb_stream.c
+++ b/usb_stream/pcm_usb_stream.c
@@ -424,8 +424,10 @@ static int snd_pcm_us_open(snd_pcm_t **pcmp, const char *name,
}
VDBG("%i %s", stream, us_name);
us->uus = get_uus(card);
- if (!us->uus)
+ if (!us->uus) {
+ free(us);
return -ENOMEM;
+ }
err = snd_hwdep_open(&us->hwdep, us_name, O_RDWR);
if (err < 0) {
us_free(us);
--
2.19.1
@@ -0,0 +1,37 @@
From 9ff42e4baf03a84eca83b8c25e0165572259d253 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Tue, 23 Oct 2018 08:47:16 +0200
Subject: [PATCH 2/4] pcm_usb_stream: remove unused parameter in
snd_pcm_us_read()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
usb_stream/pcm_usb_stream.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/usb_stream/pcm_usb_stream.c b/usb_stream/pcm_usb_stream.c
index 5ca1c0f0d04e..6d08c37e2d2d 100644
--- a/usb_stream/pcm_usb_stream.c
+++ b/usb_stream/pcm_usb_stream.c
@@ -297,7 +297,7 @@ static snd_pcm_sframes_t snd_pcm_us_write(snd_pcm_ioplug_t *io,
return size;
}
-static int usb_stream_read(struct user_usb_stream *uus, void *to, unsigned bytes)
+static int usb_stream_read(struct user_usb_stream *uus, void *to)
{
struct usb_stream *s = uus->s;
int p = s->inpacket_split, l = 0;
@@ -337,8 +337,7 @@ static snd_pcm_sframes_t snd_pcm_us_read(snd_pcm_ioplug_t *io,
return -EINVAL;
}
if (us->uus->s->periods_done - us->periods_done == 1) {
- red = usb_stream_read(us->uus, to, size * frame_size) /
- frame_size;
+ red = usb_stream_read(us->uus, to) / frame_size;
us->periods_done++;
return red;
}
--
2.19.1
@@ -0,0 +1,43 @@
From cbe7907f46ce9dcd73be392f6660c76767ce3c99 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Tue, 23 Oct 2018 08:49:23 +0200
Subject: [PATCH 3/4] pcm_usb_stream: fix signess issues
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
usb_stream/pcm_usb_stream.c | 4 ++--
usb_stream/usb_stream.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/usb_stream/pcm_usb_stream.c b/usb_stream/pcm_usb_stream.c
index 6d08c37e2d2d..3f74abad5471 100644
--- a/usb_stream/pcm_usb_stream.c
+++ b/usb_stream/pcm_usb_stream.c
@@ -300,9 +300,9 @@ static snd_pcm_sframes_t snd_pcm_us_write(snd_pcm_ioplug_t *io,
static int usb_stream_read(struct user_usb_stream *uus, void *to)
{
struct usb_stream *s = uus->s;
- int p = s->inpacket_split, l = 0;
+ unsigned p = s->inpacket_split, l = 0;
void *i = (void *)s + s->inpacket[p].offset + s->inpacket_split_at;
- int il = s->inpacket[p].length - s->inpacket_split_at;
+ unsigned il = s->inpacket[p].length - s->inpacket_split_at;
do {
if (l + il > s->period_size)
diff --git a/usb_stream/usb_stream.h b/usb_stream/usb_stream.h
index 4dd74ab1e9cc..96f8d9e94463 100644
--- a/usb_stream/usb_stream.h
+++ b/usb_stream/usb_stream.h
@@ -39,7 +39,7 @@ struct usb_stream {
unsigned read_size;
unsigned write_size;
- int period_size;
+ unsigned period_size;
unsigned state;
--
2.19.1
@@ -0,0 +1,34 @@
From a4e7e1282c57a2f4e83afe9a4008042d8b4c5bb9 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Tue, 23 Oct 2018 09:32:46 +0200
Subject: [PATCH 4/4] a52_close: set slave to NULL to avoid double pcm free in
open fcn
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
a52/pcm_a52.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/a52/pcm_a52.c b/a52/pcm_a52.c
index e431fd07e06c..b005bc2040c0 100644
--- a/a52/pcm_a52.c
+++ b/a52/pcm_a52.c
@@ -654,10 +654,13 @@ static int a52_poll_revents(snd_pcm_ioplug_t *io, struct pollfd *pfd,
static int a52_close(snd_pcm_ioplug_t *io)
{
struct a52_ctx *rec = io->private_data;
+ snd_pcm_t *slave = rec->slave;
a52_free(rec);
- if (rec->slave)
- return snd_pcm_close(rec->slave);
+ if (slave) {
+ rec->slave = NULL;
+ return snd_pcm_close(slave);
+ }
return 0;
}
--
2.19.1