Hans Leidekker : mapi32: Prevent freeing non-allocated memory.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Feb 9 05:47:14 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 32affb8ac566503f51f335c923a10cac78bd3772
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=32affb8ac566503f51f335c923a10cac78bd3772

Author: Hans Leidekker <hans at it.vu.nl>
Date:   Thu Feb  9 12:07:18 2006 +0100

mapi32: Prevent freeing non-allocated memory.

---

 dlls/mapi32/sendmail.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/mapi32/sendmail.c b/dlls/mapi32/sendmail.c
index 265ec8a..3d9c545 100644
--- a/dlls/mapi32/sendmail.c
+++ b/dlls/mapi32/sendmail.c
@@ -63,7 +63,7 @@ ULONG WINAPI MAPISendMail( LHANDLE sessi
     unsigned int i, to_count = 0, cc_count = 0, bcc_count = 0;
     unsigned int to_size = 0, cc_size = 0, bcc_size = 0, subj_size, body_size;
 
-    char *address = "", *to = "", *cc = "", *bcc = "", *subject, *body;
+    char *address = "", *to = NULL, *cc = NULL, *bcc = NULL, *subject, *body;
     static const char format[] =
         "mailto:\"%s\"?subject=\"%s\"&cc=\"%s\"&bcc=\"%s\"&body=\"%s\"";
     char *mailto = NULL, *escape = NULL;
@@ -173,7 +173,7 @@ ULONG WINAPI MAPISendMail( LHANDLE sessi
     mailto = HeapAlloc( GetProcessHeap(), 0, size );
     if (!mailto) goto exit;
 
-    sprintf( mailto, format, to, subject, cc, bcc, body );
+    sprintf( mailto, format, to ? to : "", subject, cc ? cc : "", bcc ? bcc : "", body );
 
     size = 0;
     res = UrlEscapeA( mailto, NULL, &size, URL_ESCAPE_SPACES_ONLY );




More information about the wine-cvs mailing list