AmendHub

Download:

jcs

/

subtext

/

amendments

/

206

board: Don't pre-alloc a bunch of ids in board_find_post_ids

If we return early or we return no ids, we shouldn't have a dangling
malloc(sizeof(long) * 16) that the caller might not know to free
since the count returned will be 0.

jcs made amendment 206 about 1 year ago
--- board.c Tue Jul 12 22:47:31 2022 +++ board.c Fri Jul 15 21:38:25 2022 @@ -678,8 +678,8 @@ board_find_post_ids(struct board *board, size_t *npost short i, j; char *data; - post_ids_size = sizeof(long) * 16; - *post_ids = xmalloc(post_ids_size); + post_ids_size = 0; + *post_ids = NULL; *npost_ids = 0; nall_post_ids = 0;