alsa/0012-coverity-fixes.patch
Ismail Dönmez 98d999615a Accepting request 357797 from home:tiwai:branches:multimedia:libs
- Backports from upstream: minor PCM fixes, topology API updates,
  and a few build cleanup:
  0002-pcm-simple-Fix-asserts.patch
  0003-topology-open-topology-files-with-O_TRUNC.patch
  0004-topology-Remove-unused-function-write_data_block.patch
  0005-topology-Remove-unused-variables.patch
  0006-topology-Fix-comparison-of-unsigned-expression-0.patch
  0007-topology-Not-compare-a-for-loop-iterator-with-ABI-__.patch
  0008-topology-Quit-and-show-error-message-on-big-endian-m.patch
  0009-config-files-do-not-include-ucm-topology-configurati.patch
  0010-control-add-missing-asserts-to-ctl_elem_set-function.patch
  0011-pcm_hw-fix-possible-memory-leak-coverity.patch
  0012-coverity-fixes.patch
  0013-topology-fix-debug-output-to-print-correct-max-value.patch

OBS-URL: https://build.opensuse.org/request/show/357797
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=192
2016-02-05 07:31:48 +00:00

90 lines
2.8 KiB
Diff

From df20aa2a1ea9cbcb3eb96c5684c1a00de29e2730 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Tue, 12 Jan 2016 16:25:42 +0100
Subject: [PATCH] coverity fixes
---
aserver/aserver.c | 1 +
src/control/control.c | 2 +-
src/control/ctlparse.c | 4 ++--
src/control/namehint.c | 2 ++
src/pcm/pcm_multi.c | 2 ++
5 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/aserver/aserver.c b/aserver/aserver.c
index 1579da7b44eb..ac20706b9e0b 100644
--- a/aserver/aserver.c
+++ b/aserver/aserver.c
@@ -93,6 +93,7 @@ static int make_inet_socket(int port)
return result;
}
+ memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
addr.sin_addr.s_addr = INADDR_ANY;
diff --git a/src/control/control.c b/src/control/control.c
index 8504d07668cd..328920d989c3 100644
--- a/src/control/control.c
+++ b/src/control/control.c
@@ -411,7 +411,7 @@ int snd_ctl_elem_add_enumerated(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
bytes = 0;
for (i = 0; i < items; ++i)
bytes += strlen(names[i]) + 1;
- buf = malloc(bytes);
+ buf = bytes ? malloc(bytes) : NULL;
if (!buf)
return -ENOMEM;
info->value.enumerated.names_ptr = (uintptr_t)buf;
diff --git a/src/control/ctlparse.c b/src/control/ctlparse.c
index 877a05e3a1f1..d38b44ef986c 100644
--- a/src/control/ctlparse.c
+++ b/src/control/ctlparse.c
@@ -62,7 +62,7 @@ static long get_integer(const char **ptr, long min, long max)
val = strtol(s, &p, 0);
if (*p == '.') {
p++;
- strtol(p, &p, 10);
+ (void)strtol(p, &p, 10);
}
if (*p == '%') {
val = (long)convert_prange1(strtod(s, NULL), min, max);
@@ -90,7 +90,7 @@ static long long get_integer64(const char **ptr, long long min, long long max)
val = strtol(s, &p, 0);
if (*p == '.') {
p++;
- strtol(p, &p, 10);
+ (void)strtol(p, &p, 10);
}
if (*p == '%') {
val = (long long)convert_prange1(strtod(s, NULL), min, max);
diff --git a/src/control/namehint.c b/src/control/namehint.c
index b3e646eb10af..856957c76d74 100644
--- a/src/control/namehint.c
+++ b/src/control/namehint.c
@@ -559,6 +559,8 @@ int snd_device_name_hint(int card, const char *iface, void ***hints)
if (err < 0)
return err;
err = snd_config_copy(&local_config_rw, local_config);
+ if (err < 0)
+ return err;
list.list = NULL;
list.count = list.allocated = 0;
list.siface = iface;
diff --git a/src/pcm/pcm_multi.c b/src/pcm/pcm_multi.c
index 4b8299ed6bcd..c4b1fba32cac 100644
--- a/src/pcm/pcm_multi.c
+++ b/src/pcm/pcm_multi.c
@@ -888,6 +888,8 @@ static int snd_pcm_multi_set_chmap(snd_pcm_t *pcm, const snd_pcm_chmap_t *map)
slave_maps[i] = calloc(multi->slaves[i].channels_count + 1,
sizeof(int));
if (!slave_maps[i]) {
+ for (i++; i < multi->slaves_count; i++)
+ slave_maps[i] = NULL;
err = -ENOMEM;
goto error;
}
--
2.7.0