X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fencode_rfc2047.c;h=4e4cbefbf3ada215daef01e242dc64e175aefdee;hp=852c26135ad275d24748e4179d5234fd30994d53;hb=fc9279e818dfc96c63a5d75a89080cc68cfe1170;hpb=5d690daafbcd4ed26d19610fcc017999ee5af892 diff --git a/sbr/encode_rfc2047.c b/sbr/encode_rfc2047.c index 852c261..4e4cbef 100644 --- a/sbr/encode_rfc2047.c +++ b/sbr/encode_rfc2047.c @@ -204,7 +204,7 @@ field_encode_quoted(const char *name, char **value, const char *charset, ** least one) until we get to the actual ** text. Copy until we get to a non-space. */ - output = mh_xmalloc(outlen); + output = mh_xcalloc(outlen, sizeof(char)); q = output; while (is_fws(*p)) { *q++ = *p++; @@ -299,7 +299,7 @@ field_encode_quoted(const char *name, char **value, const char *charset, } *q = '\0'; - free(*value); + mh_free0(value); *value = output; return 0; @@ -340,7 +340,7 @@ utf8len(const char *p) static void unfold_header(char **value, int len) { - char *str = mh_xmalloc(len + 1); + char *str = mh_xcalloc(len + 1, sizeof(char)); char *p = str, *q = *value; while (*q != '\0') { @@ -367,7 +367,7 @@ unfold_header(char **value, int len) } *p = '\0'; - free(*value); + mh_free0(value); *value = str; } @@ -574,8 +574,7 @@ do_reformat: output = add(cp, output); column += len; - free(cp); - cp = NULL; + mh_free0(&cp); } /* @@ -588,17 +587,17 @@ do_reformat: output = add("\n", output); - free(*value); + mh_free0(value); *value = output; output = NULL; out: if (tmpbuf) { - free(tmpbuf); + mh_free0(&tmpbuf); } if (output) { - free(output); + mh_free0(&output); } return errflag > 0;