From: Grant Erickson <gerickson@nuovations.com>
To: connman@lists.linux.dev
Subject: [PATCH] Address memory leak in '__connman_service_timeserver_remove'.
Date: Thu, 19 Oct 2023 18:16:05 -0700 [thread overview]
Message-ID: <BCE23F3F-84F5-4CAE-9F88-13A0FD4765D5@nuovations.com> (raw)
This addresses a potential memory leak of memory pointed to by 'servers'
identifed by clang/LLVM scan-build-11.
---
src/service.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/service.c b/src/service.c
index 06d02322..6c179921 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3044,8 +3044,10 @@ int __connman_service_timeserver_remove(struct connman_service *service,
for (i = 0, j = 0; i < len; i++) {
if (g_strcmp0(service->timeservers[i], timeserver) != 0) {
servers[j] = g_strdup(service->timeservers[i]);
- if (!servers[j])
+ if (!servers[j]) {
+ g_strfreev(servers);
return -ENOMEM;
+ }
j++;
}
}
--
2.32.0
next reply other threads:[~2023-10-20 1:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-20 1:16 Grant Erickson [this message]
2023-11-07 15:20 ` [PATCH] Address memory leak in '__connman_service_timeserver_remove' Marcel Holtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BCE23F3F-84F5-4CAE-9F88-13A0FD4765D5@nuovations.com \
--to=gerickson@nuovations.com \
--cc=connman@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).