From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Zsh workers <zsh-workers@zsh.org>
Subject: PATCH: memory leak found by coverity
Date: Thu, 05 Apr 2018 16:46:05 +0200 [thread overview]
Message-ID: <26914.1522939565@thecus> (raw)
Coverity also identifies a memory leak in the case of these two error
messages. This is new code since the last release.
Oliver
diff --git a/Src/params.c b/Src/params.c
index de7730ae7..36f5f0676 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -3216,7 +3216,7 @@ assignaparam(char *s, char **val, int flags)
* This only applies if the flag ASSPM_KEY_VALUE is passed in,
* indicating prefork() detected this syntax.
*
- * For associative arrays we just junk the Makrer elements.
+ * For associative arrays we just junk the Marker elements.
*/
if (flags & ASSPM_KEY_VALUE) {
char **aptr;
@@ -3243,6 +3243,7 @@ assignaparam(char *s, char **val, int flags)
(!isset(KSHARRAYS) && *iptr == 0)) {
unqueue_signals();
zerr("bad subscript for direct array assignment: %s", *aptr);
+ freearray(val);
return NULL;
}
if (!isset(KSHARRAYS))
@@ -3260,6 +3261,7 @@ assignaparam(char *s, char **val, int flags)
fullval = zshcalloc((maxlen+1) * sizeof(char *));
if (!fullval) {
zerr("array too large");
+ freearray(val);
return NULL;
}
fullval[maxlen] = NULL;
reply other threads:[~2018-04-05 14:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=26914.1522939565@thecus \
--to=okiddle@yahoo.co.uk \
--cc=zsh-workers@zsh.org \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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 NNTP newsgroup(s).