[monitoring-plugins] fixed initialization of server_url (freeing ...

Andreas Baumann git at monitoring-plugins.org
Thu May 31 14:50:16 CEST 2018


 Module: monitoring-plugins
 Branch: feature_check_curl
 Commit: eacaad30433607fbdcf742aad4ff51aad5ddf749
 Author: Andreas Baumann <mail at andreasbaumann.cc>
   Date: Thu May 31 14:43:02 2018 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=eacaad3

fixed initialization of server_url (freeing non-pointer in case of redirects)

---

 plugins/check_curl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index 9e13766..73b3aad 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -129,7 +129,7 @@ int invert_regex = 0;
 
 char *server_address;
 char *host_name;
-char *server_url = DEFAULT_SERVER_URL;
+char *server_url = 0;
 char server_ip[DEFAULT_BUFFER_SIZE];
 struct curl_slist *server_ips = NULL;
 unsigned short server_port = HTTP_PORT;
@@ -1160,6 +1160,8 @@ process_arguments (int argc, char **argv)
       strcpy (argv[c], "-n");
   }
 
+  server_url = strdup(DEFAULT_SERVER_URL);
+
   while (1) {
     c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:d:e:p:s:R:r:u:f:C:J:K:nlLS::m:M:NE", longopts, &option);
     if (c == -1 || c == EOF || c == 1)



More information about the Commits mailing list