From b96a8424f0ec6206238b650c2c63b4bd006ab43a Mon Sep 17 00:00:00 2001 From: Lorenz Kästle Date: Wed, 26 Apr 2023 09:15:04 +0200 Subject: Avoid unnecessary malloc and use stack instead --- plugins/check_curl.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/plugins/check_curl.c b/plugins/check_curl.c index 67ae2b02..6294fa0b 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c @@ -1062,11 +1062,7 @@ GOT_FIRST_CERT: bcopy("...",&output_header_search[sizeof(output_header_search)-4],4); } - char *tmp = malloc(DEFAULT_BUFFER_SIZE); - - if (tmp == NULL) { - die(STATE_UNKNOWN, "Failed to allocate buffer for output: %s\n", strerror(errno)); - } + char tmp[DEFAULT_BUFFER_SIZE]; snprintf (tmp, DEFAULT_BUFFER_SIZE, @@ -1079,7 +1075,6 @@ GOT_FIRST_CERT: server_url); strcpy(msg, tmp); - free(tmp); result = STATE_CRITICAL; } -- cgit v1.2.3-74-g34f1