diff options
author | Lorenz Kästle <lorenz.kaestle@netways.de> | 2023-04-26 09:15:04 +0200 |
---|---|---|
committer | Lorenz Kästle <lorenz.kaestle@netways.de> | 2023-04-26 09:15:04 +0200 |
commit | b96a8424f0ec6206238b650c2c63b4bd006ab43a (patch) | |
tree | 1725347aaa1c4c1aa6e41f76cdb7bcb6045cd28d /plugins/check_curl.c | |
parent | cb5579793731e3320330551bb2f926be7c7d0378 (diff) | |
download | monitoring-plugins-b96a8424f0ec6206238b650c2c63b4bd006ab43a.tar.gz |
Avoid unnecessary malloc and use stack instead
Diffstat (limited to 'plugins/check_curl.c')
-rw-r--r-- | plugins/check_curl.c | 7 |
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 | } |