mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-14 21:25:12 +08:00
Update to FreeBSD head 2017-06-01
Git mirror commit dfb26efac4ce9101dda240e94d9ab53f80a9e131. Update #3472.
This commit is contained in:
@@ -133,8 +133,10 @@ parse_string(FILE *cfile)
|
||||
error("no memory for string %s.", val);
|
||||
memcpy(s, val, valsize);
|
||||
|
||||
if (!parse_semi(cfile))
|
||||
if (!parse_semi(cfile)) {
|
||||
free(s);
|
||||
return (NULL);
|
||||
}
|
||||
return (s);
|
||||
}
|
||||
|
||||
@@ -248,9 +250,10 @@ parse_numeric_aggregate(FILE *cfile, unsigned char *buf, int *max,
|
||||
char *val, *t;
|
||||
size_t valsize;
|
||||
pair c = NULL;
|
||||
unsigned char *lbufp = NULL;
|
||||
|
||||
if (!bufp && *max) {
|
||||
bufp = malloc(*max * size / 8);
|
||||
lbufp = bufp = malloc(*max * size / 8);
|
||||
if (!bufp)
|
||||
error("can't allocate space for numeric aggregate");
|
||||
} else
|
||||
@@ -267,6 +270,7 @@ parse_numeric_aggregate(FILE *cfile, unsigned char *buf, int *max,
|
||||
parse_warn("too few numbers.");
|
||||
if (token != SEMI)
|
||||
skip_to_semi(cfile);
|
||||
free(lbufp);
|
||||
return (NULL);
|
||||
}
|
||||
token = next_token(&val, cfile);
|
||||
@@ -283,6 +287,7 @@ parse_numeric_aggregate(FILE *cfile, unsigned char *buf, int *max,
|
||||
(base != 16 || token != NUMBER_OR_NAME)) {
|
||||
parse_warn("expecting numeric value.");
|
||||
skip_to_semi(cfile);
|
||||
free(lbufp);
|
||||
return (NULL);
|
||||
}
|
||||
/*
|
||||
@@ -304,6 +309,7 @@ parse_numeric_aggregate(FILE *cfile, unsigned char *buf, int *max,
|
||||
|
||||
/* If we had to cons up a list, convert it now. */
|
||||
if (c) {
|
||||
free(lbufp);
|
||||
bufp = malloc(count * size / 8);
|
||||
if (!bufp)
|
||||
error("can't allocate space for numeric aggregate.");
|
||||
|
Reference in New Issue
Block a user