Prefer tf_resize_vec many places over tf_realloc.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4805 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2024-01-27 21:29:06 +00:00
parent b9987580ee
commit dc655bb359
5 changed files with 9 additions and 9 deletions

View File

@ -456,7 +456,7 @@ static void _httpd_endpoint_mem(tf_http_request_t* request)
{
const char* stack = tf_util_backtrace_to_string(alloc[i].frames, alloc[i].frames_count);
int line = snprintf(NULL, 0, "%zd bytes in %d allocations\n%s\n\n", alloc[i].size, alloc[i].count, stack);
response = tf_realloc(response, length + line);
response = tf_resize_vec(response, length + line);
snprintf(response + length, line, "%zd bytes in %d allocations\n%s\n\n", alloc[i].size, alloc[i].count, stack);
length += line - 1;
tf_free((void*)stack);