- Remove hackish modprobe install scripts for auto-loading OSS and sequencer modules (bsc#1136562); it's invoked from systemd unit file included in alsa-utils now - Backport upstream fixes: 0001-pcm-direct-Add-generic-hw_ptr_alignment-function-for.patch 0002-pcm-dshare-Added-hw_ptr_alignment-option-in-configur.patch 0003-pcm-dsnoop-Added-hw_ptr_alignment-option-in-configur.patch 0004-pcm-file-add-support-for-infile-reading-in-non-inter.patch 0005-pcm-file-use-snd_pcm_file_areas_read_infile-for-read.patch 0006-pcm-file-add-missing-unlock-on-early-return.patch 0007-ucm-Add-UCM-profile-for-CX2072X-codec-on-Baytrail-Ch.patch 0008-pcm-add-mmap_begin-callback-to-snd_pcm_fast_ops_t-ap.patch 0009-pcm-file-add-infile-read-support-for-mmap-mode.patch 0010-aserver-fix-resource-leak-coverity.patch 0011-src-conf.c-add-missing-va_end-call-coverity.patch 0012-config-parse_string-fix-the-dynamic-buffer-allocatio.patch 0013-control_shm-remove-duplicate-code-coverity.patch 0014-control_shm-add-missing-socket-close-to-the-error-pa.patch 0015-pcm-fix-memory-leak-in-_snd_pcm_parse_config_chmaps-.patch 0016-pcm_file-call-pclose-correctly-for-popen-coverity.patch 0017-pcm_hw-close-file-descriptor-in-the-error-path-in-sn.patch 0018-rawmidi-use-snd_dlobj_cache_get2-in-rawmidi-open-cov.patch 0019-rawmidi_hw-add-sanity-check-for-the-invalid-stream-a.patch 0020-topology-various-coverity-fixes.patch 0021-ucm-coverity-fixes.patch 0022-pcm_file-coverity-fixes-including-double-locking.patch 0023-topology-next-round-of-coverity-fixes.patch 0024-pcm_file-another-locking-fix-coverity.patch 0025-ucm-another-coverity-fix-in-uc_mgr_config_load.patch - Drop the downstream CX2072X UCM profile, which is replaced with OBS-URL: https://build.opensuse.org/request/show/706089 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=253
106 lines
2.7 KiB
Diff
106 lines
2.7 KiB
Diff
From 47bc6d534102aca9cc2aed1b6bdd5633ef645a3f Mon Sep 17 00:00:00 2001
|
|
From: Jaroslav Kysela <perex@perex.cz>
|
|
Date: Fri, 24 May 2019 10:27:25 +0200
|
|
Subject: [PATCH 10/25] aserver: fix resource leak coverity
|
|
|
|
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
---
|
|
aserver/aserver.c | 33 +++++++++++++++++++--------------
|
|
1 file changed, 19 insertions(+), 14 deletions(-)
|
|
|
|
diff --git a/aserver/aserver.c b/aserver/aserver.c
|
|
index 066414d8624c..6d20f3301ae0 100644
|
|
--- a/aserver/aserver.c
|
|
+++ b/aserver/aserver.c
|
|
@@ -75,6 +75,7 @@ static int make_local_socket(const char *filename)
|
|
if (bind(sock, (struct sockaddr *) addr, size) < 0) {
|
|
int result = -errno;
|
|
SYSERROR("bind failed");
|
|
+ close(sock);
|
|
return result;
|
|
}
|
|
|
|
@@ -101,6 +102,7 @@ static int make_inet_socket(int port)
|
|
if (bind(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
|
|
int result = -errno;
|
|
SYSERROR("bind failed");
|
|
+ close(sock);
|
|
return result;
|
|
}
|
|
|
|
@@ -916,10 +918,9 @@ static int inet_handler(waiter_t *waiter, unsigned short events ATTRIBUTE_UNUSED
|
|
|
|
static int server(const char *sockname, int port)
|
|
{
|
|
- int err;
|
|
+ int err, result, sockn = -1, socki = -1;
|
|
unsigned int k;
|
|
long open_max;
|
|
- int result;
|
|
|
|
if (!sockname && port < 0)
|
|
return -EINVAL;
|
|
@@ -933,36 +934,36 @@ static int server(const char *sockname, int port)
|
|
waiters = calloc((size_t) open_max, sizeof(*waiters));
|
|
|
|
if (sockname) {
|
|
- int sock = make_local_socket(sockname);
|
|
- if (sock < 0)
|
|
- return sock;
|
|
- if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) {
|
|
+ sockn = make_local_socket(sockname);
|
|
+ if (sockn < 0)
|
|
+ return sockn;
|
|
+ if (fcntl(sockn, F_SETFL, O_NONBLOCK) < 0) {
|
|
result = -errno;
|
|
SYSERROR("fcntl O_NONBLOCK failed");
|
|
goto _end;
|
|
}
|
|
- if (listen(sock, 4) < 0) {
|
|
+ if (listen(sockn, 4) < 0) {
|
|
result = -errno;
|
|
SYSERROR("listen failed");
|
|
goto _end;
|
|
}
|
|
- add_waiter(sock, POLLIN, local_handler, NULL);
|
|
+ add_waiter(sockn, POLLIN, local_handler, NULL);
|
|
}
|
|
if (port >= 0) {
|
|
- int sock = make_inet_socket(port);
|
|
- if (sock < 0)
|
|
- return sock;
|
|
- if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) {
|
|
+ socki = make_inet_socket(port);
|
|
+ if (socki < 0)
|
|
+ return socki;
|
|
+ if (fcntl(socki, F_SETFL, O_NONBLOCK) < 0) {
|
|
result = -errno;
|
|
SYSERROR("fcntl failed");
|
|
goto _end;
|
|
}
|
|
- if (listen(sock, 4) < 0) {
|
|
+ if (listen(socki, 4) < 0) {
|
|
result = -errno;
|
|
SYSERROR("listen failed");
|
|
goto _end;
|
|
}
|
|
- add_waiter(sock, POLLIN, inet_handler, NULL);
|
|
+ add_waiter(socki, POLLIN, inet_handler, NULL);
|
|
}
|
|
|
|
while (1) {
|
|
@@ -991,6 +992,10 @@ static int server(const char *sockname, int port)
|
|
}
|
|
}
|
|
_end:
|
|
+ if (sockn >= 0)
|
|
+ close(sockn);
|
|
+ if (socki >= 0)
|
|
+ close(socki);
|
|
free(pollfds);
|
|
free(waiters);
|
|
return result;
|
|
--
|
|
2.16.4
|
|
|