]> granicus.if.org Git - neomutt/commitdiff
Properly restore addresses from hcache using rfc822_new_address(). Closes #3302.
authorUnknown <kees@outflux.net>
Wed, 22 Jul 2009 12:43:48 +0000 (14:43 +0200)
committerUnknown <kees@outflux.net>
Wed, 22 Jul 2009 12:43:48 +0000 (14:43 +0200)
hcache.c
rfc822.h

index 5195918d8d15ffbdba278ebf2b5fcb0d738d8bef..56b1bc70be10c354382f2f1749448b39e5de28d3 100644 (file)
--- a/hcache.c
+++ b/hcache.c
@@ -45,6 +45,7 @@
 #include "mx.h"
 #include "lib.h"
 #include "md5.h"
+#include "rfc822.h"
 
 #if HAVE_QDBM
 static struct header_cache
@@ -231,7 +232,7 @@ restore_address(ADDRESS ** a, const unsigned char *d, int *off, int convert)
 
   while (counter)
   {
-    *a = safe_malloc(sizeof (ADDRESS));
+    *a = rfc822_new_address();
 #ifdef EXACT_ADDRESS
     restore_char(&(*a)->val, d, off, convert);
 #endif
index b645cc2fa9672b7f716d4e4be7614bc56a7c83d6..2f43bbdec7c5bae49daaad00690c00d5cf3cc67f 100644 (file)
--- a/rfc822.h
+++ b/rfc822.h
@@ -19,6 +19,8 @@
 #ifndef rfc822_h
 #define rfc822_h
 
+#include "lib.h"
+
 /* possible values for RFC822Error */
 enum
 {
@@ -60,6 +62,6 @@ extern int RFC822Error;
 extern const char *RFC822Errors[];
 
 #define rfc822_error(x) RFC822Errors[x]
-#define rfc822_new_address() calloc(1,sizeof(ADDRESS))
+#define rfc822_new_address() safe_calloc(1,sizeof(ADDRESS))
 
 #endif /* rfc822_h */