1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 13_memory.dpatch by David Schmidt <david__schmidt@users.sourceforge.net>
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: A few memory leaks plugged (mostly on error paths)
6 ## DP: Removing a double free
7 ## DP: Don't forget to malloc space for the null terminator...
10 #diff -urNad privoxy~/cgisimple.c privoxy/cgisimple.c
11 #--- privoxy~/cgisimple.c 2006-02-11 18:55:17.000000000 +0100
12 #+++ privoxy/cgisimple.c 2006-02-11 18:55:27.000000000 +0100
13 #@@ -880,12 +880,13 @@
14 # string_join (&s, html_encode(buf));
18 # if (map(exports, "contents", 1, s, 0))
22 # return JB_ERR_MEMORY;
27 # return template_fill_for_cgi(csp, "show-status-file", exports, rsp);
29 # if (!err) err = string_append(&s, " ");
31 # if (!err) err = map(exports, "invocation", 1, s, 0);
34 # if (!err) err = map(exports, "options", 1, csp->config->proxy_args, 1);
35 # if (!err) err = show_defines(exports);
37 diff -urNad privoxy~/filters.c privoxy/filters.c
38 --- privoxy~/filters.c 2006-02-11 18:55:17.000000000 +0100
39 +++ privoxy/filters.c 2006-02-11 18:55:27.000000000 +0100
41 string_append(&p, buf);
43 err = map(exports, "trusted-referrers", 1, p, 0);
49 string_append(&p, buf);
51 err = map(exports, "trust-info", 1, p, 0);
56 diff -urNad privoxy~/jbsockets.c privoxy/jbsockets.c
57 --- privoxy~/jbsockets.c 2004-01-31 10:27:50.000000000 +0100
58 +++ privoxy/jbsockets.c 2006-02-11 18:55:27.000000000 +0100
64 + if (len < 0) /* constant condition - size_t isn't ever negative */
68 diff -urNad privoxy~/loadcfg.c privoxy/loadcfg.c
69 --- privoxy~/loadcfg.c 2006-02-11 18:55:17.000000000 +0100
70 +++ privoxy/loadcfg.c 2006-02-11 18:55:37.000000000 +0100
74 config->re_filterfile_short[i] = strdup(arg);
75 - p = malloc(strlen(arg));
76 + p = malloc(strlen(arg) + 1);
79 log_error(LOG_LEVEL_FATAL, "Out of memory");
80 diff -urNad privoxy~/pcrs.c privoxy/pcrs.c
81 --- privoxy~/pcrs.c 2004-01-31 10:27:51.000000000 +0100
82 +++ privoxy/pcrs.c 2006-02-11 18:55:27.000000000 +0100
84 int pcrs_execute_list(pcrs_job *joblist, char *subject, size_t subject_length, char **result, size_t *result_length)
88 + char *old, *new = NULL;