[monitoring-plugins] Avoid working with free'ed memory

GitHub git at monitoring-plugins.org
Fri Jun 1 18:50:16 CEST 2018


    Module: monitoring-plugins
    Branch: feature_check_curl
    Commit: fa157795d06a30e6509b7521938e9a550c47d3c4
    Author: Jean-François Rameau <jf.rameau at gmail.com>
 Committer: GitHub <noreply at github.com>
      Date: Fri Jun  1 18:18:31 2018 +0200
       URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=fa15779

Avoid working with free'ed memory

---

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

diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index 4141b32..715af43 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -1920,11 +1920,11 @@ curlhelp_parse_statusline (const char *buf, curlhelp_statusline *status_line)
 
   /* Human readable message: "Not Found" CRLF */
 
-  free( first_line_buf );
   p = strtok( NULL, "" );
   if( p == NULL ) { free( status_line->first_line ); return -1; }
   status_line->msg = status_line->first_line + ( p - first_line_buf );
-
+  free( first_line_buf );
+	
   return 0;
 }
 



More information about the Commits mailing list