4 Star 0 Fork 1

src-oepkgs/alsa-lib-1

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
alsa-lib-1.1.0-coverity1.patch 2.74 KB
一键复制 编辑 原始数据 按行查看 历史
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 3/3] 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 1579da7..ac20706 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 8504d07..328920d 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 877a05e..d38b44e 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 b3e646e..856957c 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 4b8299e..c4b1fba 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.4.3
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-oepkgs/alsa-lib-1.git
git@gitee.com:src-oepkgs/alsa-lib-1.git
src-oepkgs
alsa-lib-1
alsa-lib-1
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385