Date: Mon, 22 Jan 2018 04:15:13 +0000 (UTC) From: Eitan Adler <eadler@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328244 - stable/11/usr.bin/units Message-ID: <201801220415.w0M4FDg5020870@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: eadler Date: Mon Jan 22 04:15:12 2018 New Revision: 328244 URL: https://svnweb.freebsd.org/changeset/base/328244 Log: MFC r328008: units(1) free savescr in error condition too CID: 978392 Modified: stable/11/usr.bin/units/units.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/units/units.c ============================================================================== --- stable/11/usr.bin/units/units.c Mon Jan 22 03:38:10 2018 (r328243) +++ stable/11/usr.bin/units/units.c Mon Jan 22 04:15:12 2018 (r328244) @@ -352,6 +352,7 @@ addunit(struct unittype * theunit, const char *toadd, num = atof(item); if (!num) { zeroerror(); + free(savescr); return 1; } if (doingtop ^ flip) { @@ -364,6 +365,7 @@ addunit(struct unittype * theunit, const char *toadd, num = atof(divider + 1); if (!num) { zeroerror(); + free(savescr); return 1; } if (doingtop ^ flip) { @@ -378,6 +380,7 @@ addunit(struct unittype * theunit, const char *toadd, num = atof(item); if (!num) { zeroerror(); + free(savescr); return 1; } if (doingtop ^ flip) { @@ -399,9 +402,12 @@ addunit(struct unittype * theunit, const char *toadd, repeat = item[strlen(item) - 1] - '0'; item[strlen(item) - 1] = 0; } - for (; repeat; repeat--) - if (addsubunit(doingtop ^ flip ? theunit->numerator : theunit->denominator, item)) + for (; repeat; repeat--) { + if (addsubunit(doingtop ^ flip ? theunit->numerator : theunit->denominator, item)) { + free(savescr); return 1; + } + } } item = strtok(NULL, " *\t/\n"); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801220415.w0M4FDg5020870>