From c3e4d0cf3f1fd24164e0a58db23b86b56c6dc7c8 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sun, 8 Sep 2013 12:46:20 +0200 Subject: Fixes based on problems from a static checker. --- builtin.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'builtin.c') 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); } -- cgit v1.2.3 From 2fcffaeee37416708fab505209a55ddd32846463 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 13 Sep 2013 15:37:25 +0300 Subject: Fix problem when extending NF. See test/nfloop. --- builtin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin.c') diff --git a/builtin.c b/builtin.c index eb823ac1..9258ea60 100644 --- a/builtin.c +++ b/builtin.c @@ -2159,7 +2159,7 @@ do_print_rec(int nargs, int redirtype) f0 = fields_arr[0]; - if (do_lint && f0 == Nnull_string) + if (do_lint && (f0->flags & NULL_FIELD) != 0) lintwarn(_("reference to uninitialized field `$%d'"), 0); efwrite(f0->stptr, sizeof(char), f0->stlen, fp, "print", rp, false); -- cgit v1.2.3