From: Michael Tremer Date: Wed, 23 Oct 2024 11:57:35 +0000 (+0000) Subject: util: Use our custom realloc function everywhere else, too X-Git-Tag: 0.9.30~921 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=69a7a985578c32d106965524eb3024c326b585f7;p=pakfire.git util: Use our custom realloc function everywhere else, too Signed-off-by: Michael Tremer --- diff --git a/src/cli/lib/progressbar.c b/src/cli/lib/progressbar.c index 5472c0141..54c84ce45 100644 --- a/src/cli/lib/progressbar.c +++ b/src/cli/lib/progressbar.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "progressbar.h" #include "terminal.h" @@ -350,7 +351,7 @@ static int cli_progressbar_add_percentage(struct cli_progressbar* p) { static ssize_t cli_progressbar_bar(struct cli_progressbar* p, struct cli_progressbar_widget* widget, unsigned int width, void* data) { // Allocate or adjust the buffer - widget->buffer = realloc(widget->buffer, width + 1); + widget->buffer = pakfire_realloc(widget->buffer, width + 1); // Fail if we could not allocate the buffer if (!widget->buffer) diff --git a/src/libpakfire/string.c b/src/libpakfire/string.c index bf64d2980..eba971164 100644 --- a/src/libpakfire/string.c +++ b/src/libpakfire/string.c @@ -27,6 +27,7 @@ #include #include +#include int __pakfire_string_format(char* s, const size_t length, const char* format, ...) { va_list args; @@ -185,7 +186,7 @@ static int pakfire_string_append(char** buffer, const char* s, const size_t l) { size_t length = (buffer && *buffer) ? strlen(*buffer) : 0; // Resize the buffer - *buffer = realloc(*buffer, length + l + 1); + *buffer = pakfire_realloc(*buffer, length + l + 1); if (!*buffer) return -errno; diff --git a/src/libpakfire/xfer.c b/src/libpakfire/xfer.c index 23df4fbf8..6909c2436 100644 --- a/src/libpakfire/xfer.c +++ b/src/libpakfire/xfer.c @@ -948,7 +948,7 @@ static const char* curl_http_version(long v) { static int pakfire_xfer_allocate(struct pakfire_xfer* xfer, size_t size) { // Otherwise, we resize the buffer - xfer->buffer.data = realloc(xfer->buffer.data, size); + xfer->buffer.data = pakfire_realloc(xfer->buffer.data, size); if (!xfer->buffer.data) { CTX_ERROR(xfer->ctx, "Could not allocate memory: %m\n");