aboutsummaryrefslogtreecommitdiffstats
path: root/unmime.c
diff options
context:
space:
mode:
Diffstat (limited to 'unmime.c')
-rw-r--r--unmime.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/unmime.c b/unmime.c
index 0f0dcf42..32a4ed72 100644
--- a/unmime.c
+++ b/unmime.c
@@ -14,6 +14,13 @@
#include <string.h>
#include <stdlib.h>
+#if defined(HAVE_ALLOCA_H)
+#include <alloca.h>
+#else
+#ifdef _AIX
+ #pragma alloca
+#endif
+#endif
#include <ctype.h>
#include "fetchmail.h"
@@ -363,7 +370,7 @@ int MimeBodyType(unsigned char *hdrs, int WantDecode)
XferEncOfs = NxtHdr;
p = nxtaddr(NxtHdr);
if (p != NULL) {
- XferEnc = (char *)xmalloc(strlen(p) + 1);
+ XferEnc = (char *)alloca(strlen(p) + 1);
strcpy(XferEnc, p);
HdrsFound++;
}
@@ -394,7 +401,7 @@ int MimeBodyType(unsigned char *hdrs, int WantDecode)
} while ( (p != NULL) && ((*(p+1) == '\t') || (*(p+1) == ' ')) );
if (p == NULL) p = NxtHdr + strlen(NxtHdr);
- CntType = (char *)xmalloc(p-NxtHdr+2);
+ CntType = (char *)alloca(p-NxtHdr+2);
strncpy(CntType, NxtHdr, (p-NxtHdr));
*(CntType+(p-NxtHdr)) = '\0';
HdrsFound++;
@@ -402,7 +409,7 @@ int MimeBodyType(unsigned char *hdrs, int WantDecode)
else if (strncasecmp("MIME-Version:", NxtHdr, 13) == 0) {
p = nxtaddr(NxtHdr);
if (p != NULL) {
- MimeVer = (char *)xmalloc(strlen(p) + 1);
+ MimeVer = (char *)alloca(strlen(p) + 1);
strcpy(MimeVer, p);
HdrsFound++;
}
@@ -456,10 +463,6 @@ int MimeBodyType(unsigned char *hdrs, int WantDecode)
}
- if (MimeVer) free(MimeVer);
- if (XferEnc) free(XferEnc);
- if (CntType) free(CntType);
-
return BodyType;
}