projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* uip/post.c, uip/spost.c: Move the uptolow macro from spost.c to post.c
[mmh]
/
uip
/
mhparse.c
diff --git
a/uip/mhparse.c
b/uip/mhparse.c
index
0bb56da
..
fc24f5e
100644
(file)
--- a/
uip/mhparse.c
+++ b/
uip/mhparse.c
@@
-20,6
+20,7
@@
#include <h/tws.h>
#include <h/mime.h>
#include <h/mhparse.h>
#include <h/tws.h>
#include <h/mime.h>
#include <h/mhparse.h>
+#include <h/utils.h>
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
@@
-259,7
+260,6
@@
parse_mime (char *file)
if (!(ct = get_content (fp, file, 1))) {
if (is_stdin)
unlink (file);
if (!(ct = get_content (fp, file, 1))) {
if (is_stdin)
unlink (file);
- fclose (fp);
advise (NULL, "unable to decode %s", file);
return NULL;
}
advise (NULL, "unable to decode %s", file);
return NULL;
}
@@
-293,6
+293,7
@@
parse_mime (char *file)
* toplevel = 0 # we are inside message type or multipart type
* # other than multipart/digest
* toplevel = -1 # we are inside multipart/digest
* toplevel = 0 # we are inside message type or multipart type
* # other than multipart/digest
* toplevel = -1 # we are inside multipart/digest
+ * NB: on failure we will fclose(in)!
*/
static CT
*/
static CT
@@
-584,8
+585,7
@@
add_header (CT ct, char *name, char *value)
HF hp;
/* allocate header field structure */
HF hp;
/* allocate header field structure */
- if (!(hp = malloc (sizeof(*hp))))
- adios (NULL, "out of memory");
+ hp = mh_xmalloc (sizeof(*hp));
/* link data into header structure */
hp->name = name;
/* link data into header structure */
hp->name = name;
@@
-1056,7
+1056,6
@@
next_part:
if (!(p = get_content (fp, ct->c_file,
ct->c_subtype == MULTI_DIGEST ? -1 : 0))) {
if (!(p = get_content (fp, ct->c_file,
ct->c_subtype == MULTI_DIGEST ? -1 : 0))) {
- fclose (ct->c_fp);
ct->c_fp = NULL;
return NOTOK;
}
ct->c_fp = NULL;
return NOTOK;
}
@@
-1285,7
+1284,6
@@
invalid_param:
fseek (fp = ct->c_fp, ct->c_begin, SEEK_SET);
if (!(p = get_content (fp, ct->c_file, 0))) {
fseek (fp = ct->c_fp, ct->c_begin, SEEK_SET);
if (!(p = get_content (fp, ct->c_file, 0))) {
- fclose (ct->c_fp);
ct->c_fp = NULL;
return NOTOK;
}
ct->c_fp = NULL;
return NOTOK;
}
@@
-1305,8
+1303,7
@@
invalid_param:
goto no_body;
}
goto no_body;
}
- if ((e->eb_body = bp = malloc ((unsigned) size)) == NULL)
- adios (NULL, "out of memory");
+ e->eb_body = bp = mh_xmalloc ((unsigned) size);
fseek (p->c_fp, p->c_begin, SEEK_SET);
while (size > 0)
switch (cc = fread (bp, sizeof(*bp), size, p->c_fp)) {
fseek (p->c_fp, p->c_begin, SEEK_SET);
while (size > 0)
switch (cc = fread (bp, sizeof(*bp), size, p->c_fp)) {