summaryrefslogtreecommitdiffstats
path: root/plugins/check_curl.c
diff options
context:
space:
mode:
authorLorenz Kästle <lorenz.kaestle@netways.de>2023-04-26 09:15:04 +0200
committerLorenz Kästle <lorenz.kaestle@netways.de>2023-04-26 09:15:04 +0200
commitb96a8424f0ec6206238b650c2c63b4bd006ab43a (patch)
tree1725347aaa1c4c1aa6e41f76cdb7bcb6045cd28d /plugins/check_curl.c
parentcb5579793731e3320330551bb2f926be7c7d0378 (diff)
downloadmonitoring-plugins-b96a8424f0ec6206238b650c2c63b4bd006ab43a.tar.gz
Avoid unnecessary malloc and use stack instead
Diffstat (limited to 'plugins/check_curl.c')
-rw-r--r--plugins/check_curl.c7
1 files changed, 1 insertions, 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:
1062 bcopy("...",&output_header_search[sizeof(output_header_search)-4],4); 1062 bcopy("...",&output_header_search[sizeof(output_header_search)-4],4);
1063 } 1063 }
1064 1064
1065 char *tmp = malloc(DEFAULT_BUFFER_SIZE); 1065 char tmp[DEFAULT_BUFFER_SIZE];
1066
1067 if (tmp == NULL) {
1068 die(STATE_UNKNOWN, "Failed to allocate buffer for output: %s\n", strerror(errno));
1069 }
1070 1066
1071 snprintf (tmp, 1067 snprintf (tmp,
1072 DEFAULT_BUFFER_SIZE, 1068 DEFAULT_BUFFER_SIZE,
@@ -1079,7 +1075,6 @@ GOT_FIRST_CERT:
1079 server_url); 1075 server_url);
1080 1076
1081 strcpy(msg, tmp); 1077 strcpy(msg, tmp);
1082 free(tmp);
1083 1078
1084 result = STATE_CRITICAL; 1079 result = STATE_CRITICAL;
1085 } 1080 }