From b96a8424f0ec6206238b650c2c63b4bd006ab43a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20K=C3=A4stle?= Date: Wed, 26 Apr 2023 09:15:04 +0200 Subject: Avoid unnecessary malloc and use stack instead diff --git a/plugins/check_curl.c b/plugins/check_curl.c index 67ae2b0..6294fa0 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 v0.10-9-g596f