Fix some static analysis issues

This commit is contained in:
Justine Tunney 2024-07-27 09:16:54 -07:00
parent fb54604b31
commit f147d3dde9
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
30 changed files with 375 additions and 266 deletions

View file

@ -254,11 +254,15 @@ int __vcscanf(int callback(void *), //
c = READ;
}
fpbufsize = FP_BUFFER_GROW;
fpbuf = malloc(fpbufsize);
fpbufcur = 0;
fpbuf[fpbufcur++] = c;
fpbuf[fpbufcur] = '\0';
goto ConsumeFloatingPointNumber;
if ((fpbuf = malloc(fpbufsize))) {
fpbufcur = 0;
fpbuf[fpbufcur++] = c;
fpbuf[fpbufcur] = '\0';
goto ConsumeFloatingPointNumber;
} else {
items = -1;
goto Done;
}
default:
items = einval();
goto Done;
@ -513,12 +517,16 @@ int __vcscanf(int callback(void *), //
if (discard) {
buf = NULL;
} else if (ismalloc) {
buf = malloc(bufsize * charbytes);
struct FreeMe *entry;
if (buf && (entry = calloc(1, sizeof(struct FreeMe)))) {
entry->ptr = buf;
entry->next = freeme;
freeme = entry;
if ((buf = malloc(bufsize * charbytes))) {
struct FreeMe *entry;
if (buf && (entry = calloc(1, sizeof(struct FreeMe)))) {
entry->ptr = buf;
entry->next = freeme;
freeme = entry;
}
} else {
items = -1;
goto Done;
}
} else {
buf = va_arg(va, void *);