Fix uninitialized use of ret in expr(1)
This commit is contained in:
parent
b3ae1a7b4b
commit
7b8d7fb78e
7
expr.c
7
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 };
|
||||
|
|
Loading…
Reference in New Issue
Block a user