sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit 7b8d7fb78edc79a99f0c2a67b5a8ca725ec56424
parent b3ae1a7b4b9832d1978fe4676758e53887248c5e
Author: sin <sin@2f30.org>
Date:   Sun, 16 Nov 2014 14:43:10 +0000

Fix uninitialized use of ret in expr(1)

Diffstat:
Mexpr.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/expr.c b/expr.c @@ -117,10 +117,11 @@ match(Val vstr, Val vregx) if (re.re_nsub) { len = matches[1].rm_eo - matches[1].rm_so + 1; - ret = emalloc(len); /* TODO: free ret */ - d = strtoimax(ret, &p, 10); + ret = malloc(len); /* TODO: free ret */ + if (!ret) + enprintf(3, "malloc:"); strlcpy(ret, str + matches[1].rm_so, len); - + d = strtoimax(ret, &p, 10); if (*ret && !*p) return (Val){ NULL, d }; return (Val){ ret, 0 };