Fix a theoretical memory leak in cgi_show_url_info()
[privoxy.git] / parsers.c
index 3f5c626..8b1a7a7 100644 (file)
--- a/parsers.c
+++ b/parsers.c
@@ -1,4 +1,4 @@
-const char parsers_rcs[] = "$Id: parsers.c,v 1.291 2014/07/25 11:56:54 fabiankeil Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.292 2014/07/25 11:57:17 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/parsers.c,v $
@@ -3865,15 +3865,21 @@ static jb_err server_http(struct client_state *csp, char **header)
    {
       p++;
       reason_phrase = strchr(p, ' ');
-      if (reason_phrase != NULL)
-      {
-         reason_phrase++;
-      }
    }
 
-   if ((reason_phrase == NULL) || (reason_phrase[0] == '\0') ||
-      (3 != sscanf(*header, "HTTP/%u.%u %u", &major_version,
-         &minor_version, &(csp->http->status))))
+   if (reason_phrase != NULL)
+   {
+      reason_phrase++;
+   }
+   else
+   {
+      log_error(LOG_LEVEL_ERROR,
+         "Response line lacks reason phrase: %s", *header);
+      reason_phrase="";
+   }
+
+   if (3 != sscanf(*header, "HTTP/%u.%u %u", &major_version,
+         &minor_version, &(csp->http->status)))
    {
       log_error(LOG_LEVEL_ERROR,
          "Failed to parse the response line: %s", *header);