SHA256
1
0
forked from pool/alsa-utils
alsa-utils/0008-alsaucm-Don-t-double-free-empty-lists.patch
Takashi Iwai 141a404e6c Accepting request 72632 from home:tiwai:branches:multimedia:libs
- Backport alsa-utils fixes from upstream:
  0001-alsamixer-fix-display-of-active-inactive-controls.patch
  0002-alsaloop-libsamplerate-requires-specific-formats-for.patch
  0003-alsaloop-another-try-to-force-correct-formats-for-li.patch
  0004-alsamixer-fix-build-on-uClibc.patch
  0005-alsactl-init-Mute-CD-Playback-volume-by-default.patch
  0006-Revert-alsactl-Display-help-for-names-command.patch
  0007-alsaucm-Add-list1-command-for-non-tuple-lists.patch
  0008-alsaucm-Don-t-double-free-empty-lists.patch
  0009-aplay-Add-i-option-for-interactive-mode.patch
  0010-aplay-Avoid-recursive-signal-handling.patch
  0012-alsaloop-Use-AM_CFLAGS-in-Makefile.am.patch
  0013-Updated-COPYING-with-the-recent-FSF-address.patch
  0014-alsamixer-Fix-64bit-issues.patch
  0015-aplay-Add-include-files-for-mkdir.patch
  0016-aplay-Use-standard-endian-convesions.patch

OBS-URL: https://build.opensuse.org/request/show/72632
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=33
2011-06-03 13:33:27 +00:00

49 lines
1.5 KiB
Diff

From f30fbe3901da0f57a6b40102ae1c3ab3a9ff6744 Mon Sep 17 00:00:00 2001
From: Stephen Warren <swarren@nvidia.com>
Date: Thu, 2 Jun 2011 16:45:13 -0600
Subject: [PATCH 08/16] alsaucm: Don't double-free empty lists
When snd_use_case_get_list (and hence also snd_use_case_card_list) returns
an empty list, alsaucm still attempts to free it. This ends up double-
freeing the returned list, or worse, freeing an invalid pointer, depending
on how snd_use_case_get_list gets implemented. Fix alsaucm to return early
on empty lists to avoid this.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
alsaucm/usecase.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/alsaucm/usecase.c b/alsaucm/usecase.c
index f24e63e..1c94680 100644
--- a/alsaucm/usecase.c
+++ b/alsaucm/usecase.c
@@ -226,8 +226,10 @@ static int do_one(struct context *context, struct cmd *cmd, char **argv)
snd_strerror(err));
return err;
}
- if (err == 0)
+ if (err == 0) {
printf(" list is empty\n");
+ return 0;
+ }
for (i = 0; i < err / 2; i++) {
printf(" %i: %s\n", i, list[i*2]);
if (list[i*2+1])
@@ -256,8 +258,10 @@ static int do_one(struct context *context, struct cmd *cmd, char **argv)
snd_strerror(err));
return err;
}
- if (err == 0)
+ if (err == 0) {
printf(" list is empty\n");
+ return 0;
+ }
for (i = 0; i < err / entries; i++) {
printf(" %i: %s\n", i, list[i*entries]);
for (j = 0; j < entries - 1; j++)
--
1.7.5.3