summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2016-08-08 21:07:55 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2016-08-08 21:07:55 +0100
commitd5bccfc848adf0260c12fdc06bcf987769bfb350 (patch)
tree37119c4b0435d6a75a121d092b3a519330f47e3d
parent76003495bfb6712c30b07cbcaf088c80b69b720d (diff)
DKIM: reduce memory usage (2nd go)
-rw-r--r--src/src/pdkim/pdkim.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/src/pdkim/pdkim.c b/src/src/pdkim/pdkim.c
index 915b90e5c..bf2bbba6c 100644
--- a/src/src/pdkim/pdkim.c
+++ b/src/src/pdkim/pdkim.c
@@ -723,7 +723,12 @@ while (sig)
const char *p;
int q = 0;
- relaxed_data = store_get(len+1);
+ /* We want to be able to free this else we allocate
+ for the entire message which could be many MB. Since
+ we don't know what allocations the SHA routines might
+ do, not safe to use store_get()/store_reset(). */
+
+ relaxed_data = malloc(len+1);
for (p = data; *p; p++)
{
@@ -767,6 +772,7 @@ while (sig)
sig = sig->next;
}
+if (relaxed_data) free(relaxed_data);
return PDKIM_OK;
}