diff -up evolution-2.28.0/plugins/tnef-attachments/tnef-plugin.c.tnef-malloc evolution-2.28.0/plugins/tnef-attachments/tnef-plugin.c
--- evolution-2.28.0/plugins/tnef-attachments/tnef-plugin.c.tnef-malloc	2009-07-27 07:23:33.000000000 +0200
+++ evolution-2.28.0/plugins/tnef-attachments/tnef-plugin.c	2009-11-13 13:35:16.000000000 +0100
@@ -86,8 +86,7 @@ org_gnome_format_tnef(gpointer ep, EMFor
 	CamelMimePart *mainpart;
 	CamelDataWrapper *content;
 	gint len;
-	TNEFStruct *tnef;
-	tnef = (TNEFStruct *) g_malloc(sizeof(TNEFStruct));
+	TNEFStruct tnef;
 
 	tmpdir = e_mkdtemp("tnef-attachment-XXXXXX");
 	if (tmpdir == NULL)
@@ -111,14 +110,14 @@ org_gnome_format_tnef(gpointer ep, EMFor
 	camel_object_unref(out);
 
 	/* Extracting the winmail.dat */
-        TNEFInitialize(tnef);
-	tnef->Debug = verbose;
-        if (TNEFParseFile(name, tnef) == -1) {
+        TNEFInitialize(&tnef);
+	tnef.Debug = verbose;
+        if (TNEFParseFile(name, &tnef) == -1) {
             printf("ERROR processing file\n");
         }
-	processTnef(tnef);
+	processTnef(&tnef);
 
-        TNEFFree(tnef);
+        TNEFFree(&tnef);
 	/* Extraction done */
 
 	dir = opendir(tmpdir);
@@ -215,12 +214,11 @@ void processTnef(TNEFStruct *tnef) {
     Attachment *p;
     gint RealAttachment;
     gint object;
-    gchar * ifilename;
+    gchar ifilename[256];
     gint i, count;
     gint foundCal=0;
 
     FILE *fptr;
-    ifilename = (gchar *) g_malloc(sizeof(gchar) * 256);
 
     /* First see if this requires special processing. */
     /* ie: it's a Contact Card, Task, or Meeting request (vCal/vCard) */
@@ -253,11 +251,8 @@ void processTnef(TNEFStruct *tnef) {
             if ((filename=MAPIFindProperty(&(tnef->MapiProperties),
 					   PROP_TAG(PT_BINARY, PR_RTF_COMPRESSED)))
                     != MAPI_UNDEFINED) {
-                variableLength *buf;
-		buf = (variableLength *)g_malloc (sizeof(variableLength));
-		buf->data[0]='\0';
-		buf->size=0;
-                if ((buf->data = (gchar *) DecompressRTF(filename, &(buf->size))) != NULL) {
+                variableLength buf;
+                if ((buf.data = (gchar *) DecompressRTF(filename, &buf.size)) != NULL) {
                     if (filepath == NULL) {
                         sprintf(ifilename, "%s.rtf", tnef->subject.data);
                     } else {
@@ -270,15 +265,13 @@ void processTnef(TNEFStruct *tnef) {
                     if ((fptr = fopen(ifilename, "wb"))==NULL) {
                         printf("ERROR: Error writing file to disk!");
                     } else {
-                        fwrite(buf->data,
+                        fwrite(buf.data,
                                 sizeof(BYTE),
-                                buf->size,
+                                buf.size,
                                 fptr);
                         fclose(fptr);
                     }
-                    free(buf->data);
-		    buf->data[0]='\0';
-		    buf->size=0;
+                    free(buf.data);
                 }
             }
 	}
@@ -311,39 +304,38 @@ void processTnef(TNEFStruct *tnef) {
             if (object == 1) {
                 /*  This is an "embedded object", so skip the */
                 /* 16-byte identifier first. */
-                TNEFStruct *emb_tnef;
+                TNEFStruct emb_tnef;
                 DWORD signature;
-		emb_tnef = (TNEFStruct *) g_malloc(sizeof(TNEFStruct));
                 memcpy(&signature, filedata->data+16, sizeof(DWORD));
                 if (TNEFCheckForSignature(signature) == 0) {
                     /* Has a TNEF signature, so process it. */
-                    TNEFInitialize(emb_tnef);
-                    emb_tnef->Debug = tnef->Debug;
+                    TNEFInitialize(&emb_tnef);
+                    emb_tnef.Debug = tnef->Debug;
                     if (TNEFParseMemory((guchar *) filedata->data+16,
-                             filedata->size-16, emb_tnef) != -1) {
-                        processTnef(emb_tnef);
+                             filedata->size-16, i&emb_tnef) != -1) {
+                        processTnef(&emb_tnef);
                         RealAttachment = 0;
                     }
-                    TNEFFree(emb_tnef);
+                    TNEFFree(&emb_tnef);
                 }
             } else {
-                TNEFStruct *emb_tnef;
+                TNEFStruct emb_tnef;
                 DWORD signature;
-		emb_tnef = (TNEFStruct *) g_malloc(sizeof(TNEFStruct));
                 memcpy(&signature, filedata->data, sizeof(DWORD));
                 if (TNEFCheckForSignature(signature) == 0) {
                     /* Has a TNEF signature, so process it. */
-                    TNEFInitialize(emb_tnef);
-                    emb_tnef->Debug = tnef->Debug;
+                    TNEFInitialize(&emb_tnef);
+                    emb_tnef.Debug = tnef->Debug;
                     if (TNEFParseMemory((guchar *) filedata->data,
-                            filedata->size, emb_tnef) != -1) {
-                        processTnef(emb_tnef);
+                            filedata->size, &emb_tnef) != -1) {
+                        processTnef(&emb_tnef);
                         RealAttachment = 0;
                     }
-                    TNEFFree(emb_tnef);
+                    TNEFFree(&emb_tnef);
                 }
             }
             if ((RealAttachment == 1) || (saveintermediate == 1)) {
+ 		char tmpname[20];
                 /* Ok, it's not an embedded stream, so now we */
 		/* process it. */
                 if ((filename = MAPIFindProperty(&(p->MAPI),
@@ -356,10 +348,9 @@ void processTnef(TNEFStruct *tnef) {
                     }
                 }
                 if (filename->size == 1) {
-                    filename = (variableLength*)malloc(sizeof(variableLength));
                     filename->size = 20;
-                    filename->data = (gchar *)malloc(20);
-                    sprintf(filename->data, "file_%03i.dat", count);
+                    sprintf(tmpname, "file_%03i.dat", count);
+                    filename->data = tmpname;
                 }
                 if (filepath == NULL) {
                     sprintf(ifilename, "%s", filename->data);
@@ -390,8 +381,6 @@ void processTnef(TNEFStruct *tnef) {
         } /* if size>0 */
         p=p->next;
     } /* while p!= null */
-
-    g_free (ifilename);
 }
 
 void saveVCard(TNEFStruct *tnef) {
@@ -1039,12 +1028,11 @@ void saveVCalendar(TNEFStruct *tnef) {
         if ((filename=MAPIFindProperty(&(tnef->MapiProperties),
                                 PROP_TAG(PT_BINARY, PR_RTF_COMPRESSED)))
                 != MAPI_UNDEFINED) {
-            variableLength *buf;
-	    buf = (variableLength *)g_malloc (sizeof(variableLength));
-            if ((buf->data = (gchar *) DecompressRTF(filename, &(buf->size))) != NULL) {
+            variableLength buf;
+            if ((buf.data = (gchar *) DecompressRTF(filename, &buf.size)) != NULL) {
                 fprintf(fptr, "DESCRIPTION:");
-                printRtf(fptr, buf);
-                free(buf->data);
+                printRtf(fptr, &buf);
+                free(buf.data);
             }
 
         }
