aboutsummaryrefslogtreecommitdiffstats
path: root/builtin.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2013-09-08 12:46:20 +0200
committerArnold D. Robbins <arnold@skeeve.com>2013-09-08 12:46:20 +0200
commitc3e4d0cf3f1fd24164e0a58db23b86b56c6dc7c8 (patch)
tree047d8f1a255b377026cdb8717a22d253401e3540 /builtin.c
parent0b8ef2cbc3e72b40046cd07f56e1cffb27690827 (diff)
downloadegawk-c3e4d0cf3f1fd24164e0a58db23b86b56c6dc7c8.tar.gz
egawk-c3e4d0cf3f1fd24164e0a58db23b86b56c6dc7c8.tar.bz2
egawk-c3e4d0cf3f1fd24164e0a58db23b86b56c6dc7c8.zip
Fixes based on problems from a static checker.
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin.c b/builtin.c
index b8e24cb3..eb823ac1 100644
--- a/builtin.c
+++ b/builtin.c
@@ -2955,13 +2955,16 @@ set_how_many:
done:
DEREF(s);
- if ((matches == 0 || (flags & LITERAL) != 0) && buf != NULL)
+ if ((matches == 0 || (flags & LITERAL) != 0) && buf != NULL) {
efree(buf);
+ buf = NULL;
+ }
if (flags & GENSUB) {
if (matches > 0) {
/* return the result string */
DEREF(t);
+ assert(buf != NULL);
return make_str_node(buf, textlen, ALREADY_MALLOCED);
}