Reapply r301691:

Revert r301689 - one-true-awk: Avoid a NULL dereference.

I got this wrong and the coverity report doesn't match the NetBSD change,
which was thought for a different version.

The change wouldn't hurt but let's wait until upstream figures this out.
This commit is contained in:
Warner Losh 2019-06-02 20:47:15 +00:00
parent e9b659753c
commit 2675e1b91d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=348518

View File

@ -366,7 +366,7 @@ char *setsval(Cell *vp, const char *s) /* set string val of a Cell */
if (donerec == 0)
recbld();
}
t = s ? tostring(s) : tostring(""); /* in case it's self-assign */
t = tostring(s); /* in case it's self-assign */
if (freeable(vp))
xfree(vp->sval);
vp->tval &= ~(NUM|CONVC|CONVO);