Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] don't call regfree() on uninitialized regex_t
- X-seq: zsh-workers 26362
- From: Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: [PATCH] don't call regfree() on uninitialized regex_t
- Date: Mon, 19 Jan 2009 00:22:04 -0800
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
While I was fixing a few compiler warnings in zcond_regex_match(), I
noticed that regfree() could be called on an uninitialized regex_t if
the "id" value passed in to the function was invalid. Attached is one
possible fix.
..wayne..
--- Src/Modules/regex.c 19 Jan 2009 08:00:15 -0000 1.4
+++ Src/Modules/regex.c 19 Jan 2009 08:14:25 -0000
@@ -120,7 +120,7 @@ zcond_regex_match(char **a, int id)
break;
default:
DPUTS(1, "bad regex option");
- break;
+ return 0; /* nothing to cleanup, especially not "re". */
}
if (matches)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author