decompress_iob(): Fix a memory leak
[privoxy.git] / parsers.c
index de1eea4..df7b86b 100644 (file)
--- a/parsers.c
+++ b/parsers.c
@@ -540,7 +540,7 @@ jb_err decompress_iob(struct client_state *csp)
 
    cur = csp->iob->cur;
 
-   if (bufsize < (size_t)10)
+   if (old_size < (size_t)10)
    {
       /*
        * This is to protect the parsing of gzipped data,
@@ -818,6 +818,7 @@ jb_err decompress_iob(struct client_state *csp)
       log_error(LOG_LEVEL_ERROR,
          "Unexpected error while decompressing to the buffer (iob): %s",
          zstr.msg);
+      freez(buf);
       return JB_ERR_COMPRESS;
    }
 
@@ -1697,7 +1698,8 @@ static jb_err filter_header(struct client_state *csp, char **header)
 
       if (NULL == joblist)
       {
-         log_error(LOG_LEVEL_RE_FILTER, "Filter %s has empty joblist. Nothing to do.", b->name);
+         log_error(LOG_LEVEL_RE_FILTER,
+            "Filter %s has empty joblist. Nothing to do.", b->name);
          continue;
       }
 
@@ -1711,7 +1713,8 @@ static jb_err filter_header(struct client_state *csp, char **header)
          if (0 < matches)
          {
             current_hits += matches;
-            log_error(LOG_LEVEL_HEADER, "Transforming \"%s\" to \"%s\"", *header, newheader);
+            log_error(LOG_LEVEL_HEADER,
+               "Transforming \"%s\" to \"%s\"", *header, newheader);
             freez(*header);
             *header = newheader;
          }
@@ -1723,7 +1726,8 @@ static jb_err filter_header(struct client_state *csp, char **header)
          else
          {
             /* RegEx failure */
-            log_error(LOG_LEVEL_ERROR, "Filtering \'%s\' with \'%s\' didn't work out: %s",
+            log_error(LOG_LEVEL_ERROR,
+               "Filtering \'%s\' with \'%s\' didn't work out: %s",
                *header, b->name, pcrs_strerror(matches));
             if (newheader != NULL)
             {