Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: memory leak found by coverity
- X-seq: zsh-workers 42597
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: memory leak found by coverity
- Date: Thu, 05 Apr 2018 16:46:05 +0200
- Authentication-results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1522939567; bh=UKnXq436WbweXIIB1nEZjTVkL4A3xRuWWGLoYqs92ws=; h=From:To:Subject:Date:From:Subject; b=JjZQqKctMTbVc/C0IVqi+Co68LdD9dbGCQAT7J9MdcyKDhA6Qt0R7yogOo27NsjMX7vjpEuGsLXa+nukcLvaQgqpxn4c705XXKjbhWD3aB1KXjcdKbKIxyj2yDzzMeEYleRu7jugQuXrLXO+ifW/ThRhPrrx/b6gMUguoTWSzWBSIVJfp1DMMCqYPNyGnMIBNUC9N4/HDYDuSeoO8dAdkHrHJUQujnQLadQkhu0BWsOSQjQI1C8YQOaXxrqLfLkRWPEgWUk4/x89AptasbFMgpj0S0mCKs0BOMZtmxA5oZg7yJ0Cq1cWchkK1rnI+twctgWRPeIpRbtx3W8NWg2tWw==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author