Fix memory leak in cgi_show_status() with extended statistics enabled
[privoxy.git] / cgisimple.c
index d7c6ccd..592e704 100644 (file)
@@ -1146,15 +1146,15 @@ static char *get_filter_statistics_table(const struct client_state *csp)
         if (b->type == FT_CONTENT_FILTER)
         {
            unsigned long long executions;
-           unsigned long long pages_modified;
+           unsigned long long response_bodies_modified;
            unsigned long long hits;
 
-           get_filter_statistics(b->name, &executions, &pages_modified, &hits);
+           get_filter_statistics(b->name, &executions, &response_bodies_modified, &hits);
            snprintf(buf, sizeof(buf),
               "<tr><td>%s</td><td style=\"text-align: right\">%llu</td>"
               "<td style=\"text-align: right\">%llu</td>"
               "<td style=\"text-align: right\">%llu</td><tr>\n",
-              b->name, executions, pages_modified, hits);
+              b->name, executions, response_bodies_modified, hits);
 
            if (!err) err = string_append(&statistics, buf);
         }
@@ -1280,26 +1280,28 @@ jb_err cgi_show_status(struct client_state *csp,
 #endif /* ndef FEATURE_STATISTICS */
 
 #ifdef FEATURE_EXTENDED_STATISTICS
+   if (!err)
    {
       char *block_reason_statistics = get_block_reason_statistics_table(csp);
       if (block_reason_statistics != NULL)
       {
-         if (!err) err = map(exports, "block-reason-statistics", 1, block_reason_statistics, 0);
+         err = map(exports, "block-reason-statistics", 1, block_reason_statistics, 0);
       }
       else
       {
-         if (!err) err = map_block_killer(exports, "extended-statistics");
+         err = map_block_killer(exports, "extended-statistics");
       }
    }
+   if (!err)
    {
       char *filter_statistics = get_filter_statistics_table(csp);
       if (filter_statistics != NULL)
       {
-         if (!err) err = map(exports, "filter-statistics", 1, filter_statistics, 0);
+         err = map(exports, "filter-statistics", 1, filter_statistics, 0);
       }
       else
       {
-         if (!err) err = map_block_killer(exports, "extended-statistics");
+         err = map_block_killer(exports, "extended-statistics");
       }
    }
 #else /* ndef FEATURE_EXTENDED_STATISTICS */