units(1): units(1) free savescr in error condition too
CID: 978392 Reviewed by: des MFC After: 1 week
This commit is contained in:
parent
ec65ea977d
commit
12b4267ad9
@ -354,6 +354,7 @@ addunit(struct unittype * theunit, const char *toadd, int flip, int quantity)
|
||||
num = atof(item);
|
||||
if (!num) {
|
||||
zeroerror();
|
||||
free(savescr);
|
||||
return 1;
|
||||
}
|
||||
if (doingtop ^ flip) {
|
||||
@ -366,6 +367,7 @@ addunit(struct unittype * theunit, const char *toadd, int flip, int quantity)
|
||||
num = atof(divider + 1);
|
||||
if (!num) {
|
||||
zeroerror();
|
||||
free(savescr);
|
||||
return 1;
|
||||
}
|
||||
if (doingtop ^ flip) {
|
||||
@ -380,6 +382,7 @@ addunit(struct unittype * theunit, const char *toadd, int flip, int quantity)
|
||||
num = atof(item);
|
||||
if (!num) {
|
||||
zeroerror();
|
||||
free(savescr);
|
||||
return 1;
|
||||
}
|
||||
if (doingtop ^ flip) {
|
||||
@ -401,9 +404,12 @@ addunit(struct unittype * theunit, const char *toadd, int flip, int quantity)
|
||||
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");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user