alsa/0040-topology-sort_config-cleanups-use-goto-for-the-error.patch
Takashi Iwai 2d37bad8df Accepting request 865334 from home:tiwai:branches:multimedia:libs
- Backport upstream fixes:
  yet more PCM plugin fixes, topology fixes/cleanups, UAF fix in
  UCM (bsc#1181194):
  0004-topology-use-inclusive-language-for-bclk.patch
  0005-topology-use-inclusive-language-for-fsync.patch
  0006-topology-use-inclusive-language-in-documentation.patch
  0034-ucm-fix-possible-memory-leak-in-parse_verb_file.patch
  0035-topology-tplg_pprint_integer-fix-coverity-uninitaliz.patch
  0036-topology-tplg_add_widget_object-do-not-use-invalid-e.patch
  0037-topology-tplg_decode_pcm-add-missing-log-argument-co.patch
  0038-topology-parse_tuple_set-remove-dead-condition-code.patch
  0039-ucm-uc_mgr_substitute_tree-fix-use-after-free.patch
  0040-topology-sort_config-cleanups-use-goto-for-the-error.patch
  0041-conf-USB-add-Xonar-U7-MKII-to-USB-Audio.pcm.iec958_d.patch
  0042-pcm_plugin-set-the-initial-hw_ptr-appl_ptr-from-the-.patch
  0043-pcm-dmix-dshare-delay-calculation-fixes-and-cleanups.patch
  0044-topology-fix-parse_tuple_set-remove-dead-condition-c.patch

OBS-URL: https://build.opensuse.org/request/show/865334
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=292
2021-01-21 10:20:59 +00:00

56 lines
1.3 KiB
Diff

From 45f503632acf24877c466a7c1c74d8a26414bf3e Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Thu, 7 Jan 2021 17:45:27 +0100
Subject: [PATCH 40/44] topology: sort_config() cleanups - use goto for the
error path
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/topology/save.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/topology/save.c b/src/topology/save.c
index f7af7af3e8c2..fecbc6a5dfa8 100644
--- a/src/topology/save.c
+++ b/src/topology/save.c
@@ -180,29 +180,28 @@ static snd_config_t *sort_config(const char *id, snd_config_t *src)
}
if (array <= 0)
qsort(a, count, sizeof(a[0]), _compar);
- if (snd_config_make_compound(&dst, id, count == 1)) {
- free(a);
- return NULL;
- }
+ if (snd_config_make_compound(&dst, id, count == 1))
+ goto lerr;
for (index = 0; index < count; index++) {
snd_config_t *s = a[index];
const char *id2;
if (snd_config_get_id(s, &id2)) {
snd_config_delete(dst);
- free(a);
- return NULL;
+ goto lerr;
}
s = sort_config(id2, s);
if (s == NULL || snd_config_add(dst, s)) {
if (s)
snd_config_delete(s);
snd_config_delete(dst);
- free(a);
- return NULL;
+ goto lerr;
}
}
free(a);
return dst;
+lerr:
+ free(a);
+ return NULL;
}
static int tplg_check_quoted(const unsigned char *p)
--
2.26.2