mh_free0() free's the memmory and set's the pointer to NULL after
the free. This avoids doublefree and dereferenc of a non valid poiter.
52 files changed:
void *mh_xrealloc(void *, size_t);
void *mh_xcalloc(size_t, size_t);
void *mh_xrealloc(void *, size_t);
void *mh_xcalloc(size_t, size_t);
char *pwd(void);
char *add(char *, char *);
void create_folder(char *, int, void (*)(int));
char *pwd(void);
char *add(char *, char *);
void create_folder(char *, int, void (*)(int));
+ mh_free0(&(mp->m_text));
+ mh_free0(&(mp->m_pers));
+ mh_free0(&(mp->m_mbox));
+ mh_free0(&(mp->m_host));
+ mh_free0(&(mp->m_path));
+ mh_free0(&(mp->m_gname));
+ mh_free0(&(mp->m_note));
while (first->m_next != NULL && first->m_next != next) {
mp = first->m_next;
first->m_next = mp->m_next;
while (first->m_next != NULL && first->m_next != next) {
mp = first->m_next;
first->m_next = mp->m_next;
}
first->m_next = next;
return -1;
}
first->m_next = next;
return -1;
/*
** Delete a key/value pair from the context/profile list.
/*
** Delete a key/value pair from the context/profile list.
pp->n_next = np->n_next;
else
m_defs = np->n_next;
pp->n_next = np->n_next;
else
m_defs = np->n_next;
+ mh_free0(&(np->n_name));
- free(np->n_field);
- free((char *) np);
+ mh_free0(&(np->n_field));
+ mh_free0(&np);
ctxflags |= CTXMOD;
return 0;
}
ctxflags |= CTXMOD;
return 0;
}
*/
#include <h/mh.h> /* mh internals */
*/
#include <h/mh.h> /* mh internals */
+#include <h/utils.h> /* mh_free0() */
#include <errno.h> /* system call errors */
#include <pwd.h> /* structure for getpwuid() results */
#include <unistd.h>
#include <errno.h> /* system call errors */
#include <pwd.h> /* structure for getpwuid() results */
#include <unistd.h>
if (!getanswer(cp)) {
adios(EX_NOPERM, NULL, "Unable to access the mail storage directory `%s'", nd);
}
if (!getanswer(cp)) {
adios(EX_NOPERM, NULL, "Unable to access the mail storage directory `%s'", nd);
}
if (!makedir(nd)) {
adios(EX_CANTCREAT, nd, "unable to create");
}
if (!makedir(nd)) {
adios(EX_CANTCREAT, nd, "unable to create");
}
if (!np->n_context)
admonish(NULL, "bug: context_replace(key=\"%s\",value=\"%s\")", key, value);
if (np->n_field)
if (!np->n_context)
admonish(NULL, "bug: context_replace(key=\"%s\",value=\"%s\")", key, value);
if (np->n_field)
+ mh_free0(&(np->n_field));
np->n_field = getcpy(value);
ctxflags |= CTXMOD;
}
np->n_field = getcpy(value);
ctxflags |= CTXMOD;
}
/* add_folder saves child in the list, don't free it */
add_folder(child, crawl);
} else {
/* add_folder saves child in the list, don't free it */
add_folder(child, crawl);
} else {
** Note that we "leak" the folder names, on the assumption that the
** caller is using them.
*/
** Note that we "leak" the folder names, on the assumption that the
** caller is using them.
*/
- free(crawl->folders);
- free(crawl);
+ mh_free0(&(crawl->folders));
+ mh_free0(&crawl);
*value = output;
return 0;
*value = output;
return 0;
output = add(cp, output);
column += len;
output = add(cp, output);
column += len;
output = add("\n", output);
output = add("\n", output);
*value = output;
output = NULL;
out:
if (tmpbuf) {
*value = output;
output = NULL;
out:
if (tmpbuf) {
size_t i;
if (format_string)
size_t i;
if (format_string)
+ mh_free0(&format_string);
format_string = getcpy(fstring);
usr_fstring = fstring;
format_string = getcpy(fstring);
usr_fstring = fstring;
if (!dstlen || !savedstlen)
goto buffull;
dstlen = savedstlen;
if (!dstlen || !savedstlen)
goto buffull;
dstlen = savedstlen;
void
folder_free(struct msgs *mp)
void
folder_free(struct msgs *mp)
return;
if (mp->foldpath)
return;
if (mp->foldpath)
+ mh_free0(&(mp->foldpath));
/* free the sequence names */
for (i = 0; mp->msgattrs[i]; i++)
/* free the sequence names */
for (i = 0; mp->msgattrs[i]; i++)
+ mh_free0(&(mp->msgattrs[i]));
- free(mp->msgstats); /* free message status area */
- free(mp); /* free main folder structure */
+ mh_free0(&(mp->msgstats)); /* free message status area */
+ mh_free0(&mp); /* free main folder structure */
name = getcpy(toabsdir(name));
if (!(dd = opendir(name))) {
name = getcpy(toabsdir(name));
if (!(dd = opendir(name))) {
return NULL;
}
if (stat(name, &st) == -1) {
return NULL;
}
if (stat(name, &st) == -1) {
closedir(dd);
return NULL;
}
closedir(dd);
return NULL;
}
for (msgnum = 0; msgnum < mp->nummsg; msgnum++)
set_exists(mp, mi[msgnum]);
for (msgnum = 0; msgnum < mp->nummsg; msgnum++)
set_exists(mp, mi[msgnum]);
- free(mi); /* We don't need this anymore */
+ mh_free0(&mi); /* We don't need this anymore */
/*
** Read and initialize the sequence information.
/*
** Read and initialize the sequence information.
tmpstats[msgnum - lo] = mp->msgstats[msgnum - mp->lowoff];
}
}
tmpstats[msgnum - lo] = mp->msgstats[msgnum - mp->lowoff];
}
}
+ mh_free0(&(mp->msgstats));
mp->msgstats = tmpstats;
}
mp->msgstats = tmpstats;
}
else
pp->l_next = lp->l_next;
else
pp->l_next = lp->l_next;
- free(lp->l_lock);
- free(lp);
+ mh_free0(&(lp->l_lock));
+ mh_free0(&lp);
if (!(mp = folder_read(folder))) {
adios(EX_IOERR, NULL, "unable to read folder %s", folder);
}
if (!(mp = folder_read(folder))) {
adios(EX_IOERR, NULL, "unable to read folder %s", folder);
}
/*
** Make sure we have enough message status space for all
/*
** Make sure we have enough message status space for all
struct adrx *adrxp = &adrxs2;
if (pers)
struct adrx *adrxp = &adrxs2;
if (pers)
- free(note);
- pers = mbox = host = path = grp = note = NULL;
err[0] = 0;
if (dp == NULL) {
dp = cp = getcpy(addrs ? addrs : "");
glevel = 0;
} else if (cp == NULL) {
err[0] = 0;
if (dp == NULL) {
dp = cp = getcpy(addrs ? addrs : "");
glevel = 0;
} else if (cp == NULL) {
return NULL;
}
switch (parse_address()) {
case DONE:
return NULL;
}
switch (parse_address()) {
case DONE:
- free(dp);
- dp = cp = NULL;
+ mh_free0(&dp);
+ cp = NULL;
}
case LX_COMA:
if (note) {
}
case LX_COMA:
if (note) {
- free(note);
- note = NULL;
case LX_AT: /* sigh (0) */
mbox = add(host, add("%", mbox));
case LX_AT: /* sigh (0) */
mbox = add(host, add("%", mbox));
- free(host);
- host = NULL;
cp = add(field, cp);
}
np->n_field = trimcpy(cp);
cp = add(field, cp);
}
np->n_field = trimcpy(cp);
} else {
np->n_field = trimcpy(field);
}
} else {
np->n_field = trimcpy(field);
}
cp = add(field, cp);
}
seq_init(mp, getcpy(name), trimcpy(cp));
cp = add(field, cp);
}
seq_init(mp, getcpy(name), trimcpy(cp));
} else {
seq_init(mp, getcpy(name), trimcpy(field));
}
} else {
seq_init(mp, getcpy(name), trimcpy(field));
}
/* Return error, if too many sequences */
if (i >= NUMATTRS) {
/* Return error, if too many sequences */
if (i >= NUMATTRS) {
- free(name);
- free(field);
+ mh_free0(&name);
+ mh_free0(&field);
** name string. Else add it to the list of sequence names.
*/
if (mp->msgattrs[i]) {
** name string. Else add it to the list of sequence names.
*/
if (mp->msgattrs[i]) {
} else {
mp->msgattrs[i] = name;
mp->msgattrs[i + 1] = NULL;
} else {
mp->msgattrs[i] = name;
mp->msgattrs[i + 1] = NULL;
- free(field); /* free string containing message ranges */
+ mh_free0(&field); /* free string containing message ranges */
/*
** Add all the messages currently SELECTED to
/*
** Add all the messages currently SELECTED to
if ((cp = context_find(psequence))) {
dp = getcpy(cp);
if (!(ap = brkstring(dp, " ", "\n")) || !*ap) {
if ((cp = context_find(psequence))) {
dp = getcpy(cp);
if (!(ap = brkstring(dp, " ", "\n")) || !*ap) {
for (; *ap; ap++)
seq_addsel(mp, *ap, -1, 1);
for (; *ap; ap++)
seq_addsel(mp, *ap, -1, 1);
+#include <h/utils.h> /* mh_free0() */
/*
** We scan through the folder and act upon all messages
/*
** We scan through the folder and act upon all messages
}
if (!(ap = brkstring(dp, " ", "\n")) || !*ap) {
/* contains no sequence name, i.e. we're finished */
}
if (!(ap = brkstring(dp, " ", "\n")) || !*ap) {
/* contains no sequence name, i.e. we're finished */
+** Free a pointer and set it to NULL.
+*/
+void
+mh_free0(void * ptr)
+{
+ void ** p;
+ p = ptr;
+ free(*p);
+ *p = NULL;
+}
+
+/*
** Return the present working directory, if the current directory does not
** exist, or is too long, make / the pwd.
*/
** Return the present working directory, if the current directory does not
** exist, or is too long, make / the pwd.
*/
/* Copy s1 and free it */
if (s1) {
memcpy(cp, s1, len1);
/* Copy s1 and free it */
if (s1) {
memcpy(cp, s1, len1);
if (!getanswer(cp)) {
done_callback(EX_CANTCREAT);
}
if (!getanswer(cp)) {
done_callback(EX_CANTCREAT);
}
} else if (autocreate == -1) {
/* do not create, so exit */
done_callback(EX_CANTCREAT);
} else if (autocreate == -1) {
/* do not create, so exit */
done_callback(EX_CANTCREAT);
print_aka(vp ? vp : s, list, 0);
if (vp)
print_aka(vp ? vp : s, list, 0);
if (vp)
if (cp) {
dp = cp;
cp = concat(cp, ",", pp, NULL);
if (cp) {
dp = cp;
cp = concat(cp, ",", pp, NULL);
+ mh_free0(&dp);
+ mh_free0(&pp);
} while (*field && *field != '-');
} while (*field && *field != '-');
} while (*field && *field != '-');
} while (*field && *field != '-');
fflush(tmp);
fflush(fp); /* The underlying fd will be closed by lkclose() */
fflush(tmp);
fflush(fp); /* The underlying fd will be closed by lkclose() */
fmt_scan(fmt, buffer, BUFSIZ, dat);
fputs(buffer, stdout);
fmt_scan(fmt, buffer, BUFSIZ, dat);
fputs(buffer, stdout);
+ mh_free0(&(p->pq_text));
+ mh_free0(&(p->pq_error));
context_replace(curfolder, folder);
/*
context_replace(curfolder, folder);
/*
if (txtfd != NOTOK) {
lseek(txtfd, (off_t) 0, SEEK_SET); /* msgnam not accurate */
if (txtfd != NOTOK) {
lseek(txtfd, (off_t) 0, SEEK_SET); /* msgnam not accurate */
}
for (cp = getcpy(getcurfol()); *ap; ap++)
cp = add(*ap, add(" ", cp));
}
for (cp = getcpy(getcurfol()); *ap; ap++)
cp = add(*ap, add(" ", cp));
context_replace(stack, cp); /* update folder stack */
} else {
/* update folder stack */
context_replace(stack, cp); /* update folder stack */
} else {
/* update folder stack */
/* delete folder stack entry from context */
context_del(stack);
}
/* delete folder stack entry from context */
context_del(stack);
}
}
if (pushsw || popsw) {
cp = toabsdir(argfolder);
}
if (pushsw || popsw) {
cp = toabsdir(argfolder);
dp = getcpy(cp);
for (ap = brkstring(dp, " ", "\n"); *ap; ap++)
printf(" %s", *ap);
dp = getcpy(cp);
for (ap = brkstring(dp, " ", "\n"); *ap; ap++)
printf(" %s", *ap);
line = mh_xcalloc(fmtsize, sizeof(char));
fmt_scan(fmt, line, fmtsize, dat);
fputs(line, tmp);
line = mh_xcalloc(fmtsize, sizeof(char));
fmt_scan(fmt, line, fmtsize, dat);
fputs(line, tmp);
if (fclose(tmp))
adios(EX_IOERR, tmpfil, "error writing");
if (fclose(tmp))
adios(EX_IOERR, tmpfil, "error writing");
+ mh_free0(&maildir_copy);
if (incerr < 0) { /* error */
if (locked) {
if (incerr < 0) { /* error */
if (locked) {
if (!*cp)
adios(EX_DATAERR, NULL, "empty pipe command for #%s directive", ci->ci_type);
cp = getcpy(cp);
if (!*cp)
adios(EX_DATAERR, NULL, "empty pipe command for #%s directive", ci->ci_type);
cp = getcpy(cp);
+ mh_free0(&(ci->ci_magic));
ci->ci_magic = cp;
} else {
/* record filename of decoded contents */
ci->ci_magic = cp;
} else {
/* record filename of decoded contents */
if (!m_convert(mp, cp))
exit(EX_USAGE);
}
if (!m_convert(mp, cp))
exit(EX_USAGE);
}
#include <errno.h>
#include <h/mime.h>
#include <h/mhparse.h>
#include <errno.h>
#include <h/mime.h>
#include <h/mhparse.h>
free_header(ct);
if (ct->c_partno)
free_header(ct);
if (ct->c_partno)
+ mh_free0(&(ct->c_partno));
+ mh_free0(&(ct->c_vrsn));
+ mh_free0(&(ct->c_ctline));
+ mh_free0(&(ct->c_charset));
+ mh_free0(&(ct->c_showproc));
+ mh_free0(&(ct->c_storeproc));
+ mh_free0(&(ct->c_celine));
/* free structures for content encodings */
free_encoding(ct, 1);
if (ct->c_id)
/* free structures for content encodings */
free_encoding(ct, 1);
if (ct->c_id)
+ mh_free0(&(ct->c_descr));
+ mh_free0(&(ct->c_dispo));
if (ct->c_file) {
if (ct->c_unlink)
unlink(ct->c_file);
if (ct->c_file) {
if (ct->c_unlink)
unlink(ct->c_file);
+ mh_free0(&(ct->c_file));
}
if (ct->c_fp)
fclose(ct->c_fp);
if (ct->c_storage)
}
if (ct->c_fp)
fclose(ct->c_fp);
if (ct->c_storage)
+ mh_free0(&(ct->c_storage));
+ mh_free0(&(ct->c_folder));
while (hp1) {
hp2 = hp1->next;
while (hp1) {
hp2 = hp1->next;
- free(hp1->name);
- free(hp1->value);
- free(hp1);
+ mh_free0(&(hp1->name));
+ mh_free0(&(hp1->value));
+ mh_free0(&hp1);
ci = &ct->c_ctinfo;
if (ci->ci_type) {
ci = &ct->c_ctinfo;
if (ci->ci_type) {
- free(ci->ci_type);
- ci->ci_type = NULL;
+ mh_free0(&(ci->ci_type));
- free(ci->ci_subtype);
- ci->ci_subtype = NULL;
+ mh_free0(&(ci->ci_subtype));
}
for (ap = ci->ci_attrs; *ap; ap++) {
}
for (ap = ci->ci_attrs; *ap; ap++) {
- free(*ap);
- *ap = NULL;
- free(ci->ci_comment);
- ci->ci_comment = NULL;
+ mh_free0(&(ci->ci_comment));
- free(ci->ci_magic);
- ci->ci_magic = NULL;
+ mh_free0(&(ci->ci_magic));
if (!(t = (struct text *) ct->c_ctparams))
return;
if (!(t = (struct text *) ct->c_ctparams))
return;
- free((char *) t);
- ct->c_ctparams = NULL;
+ mh_free0(&(m->mp_start));
+ mh_free0(&(m->mp_stop));
for (part = m->mp_parts; part; part = next) {
next = part->mp_next;
free_content(part->mp_part);
for (part = m->mp_parts; part; part = next) {
next = part->mp_next;
free_content(part->mp_part);
- free((char *) m);
- ct->c_ctparams = NULL;
return;
if (p->pm_partid)
return;
if (p->pm_partid)
+ mh_free0(&(p->pm_partid));
- free((char *) p);
- ct->c_ctparams = NULL;
if (ce->ce_file) {
if (ce->ce_unlink)
unlink(ce->ce_file);
if (ce->ce_file) {
if (ce->ce_unlink)
unlink(ce->ce_file);
- free(ce->ce_file);
- ce->ce_file = NULL;
+ mh_free0(&(ce->ce_file));
- free((char *) ce);
- ct->c_cefile = NULL;
} else {
ct->c_ceopenfnx = NULL;
}
} else {
ct->c_ceopenfnx = NULL;
}
return 1;
cp = concat("=", cp, NULL);
fmtstr = new_fs(cp, NULL);
return 1;
cp = concat("=", cp, NULL);
fmtstr = new_fs(cp, NULL);
c1->c_fstr = getcpy(fmtstr);
c1->c_flags |= FORMAT;
return 0;
c1->c_fstr = getcpy(fmtstr);
c1->c_flags |= FORMAT;
return 0;
if (fp != stdin)
fclose(fp);
if (holder.c_text) {
if (fp != stdin)
fclose(fp);
if (holder.c_text) {
- free(holder.c_text);
- holder.c_text = NULL;
+ mh_free0(&(holder.c_text));
}
free_queue(&msghd, &msgtl);
for (c1 = fmthd; c1; c1 = c1->c_next)
}
free_queue(&msghd, &msgtl);
for (c1 = fmthd; c1; c1 = c1->c_next)
holder.c_text = concat("(Message ",
mname, ")\n", NULL);
putcomp(c1, &holder, ONECOMP);
holder.c_text = concat("(Message ",
mname, ")\n", NULL);
putcomp(c1, &holder, ONECOMP);
- free(holder.c_text);
- holder.c_text = NULL;
+ mh_free0(&(holder.c_text));
continue;
}
if (!mh_strcasecmp(c1->c_name, "extras")) {
continue;
}
if (!mh_strcasecmp(c1->c_name, "extras")) {
putcomp(c1, &holder, BODYCOMP);
state = m_getfld(state, name, holder.c_text, sizeof(buf), fp);
}
putcomp(c1, &holder, BODYCOMP);
state = m_getfld(state, name, holder.c_text, sizeof(buf), fp);
}
- free(holder.c_text);
- holder.c_text = NULL;
+ mh_free0(&(holder.c_text));
continue;
}
for (c2 = msghd; c2; c2 = c2->c_next)
continue;
}
for (c2 = msghd; c2; c2 = c2->c_next)
/* Don't need to append a newline, dctime() already did */
c2->c_text = getcpy(buffer);
/* Don't need to append a newline, dctime() already did */
c2->c_text = getcpy(buffer);
c2->c_text = add(buffer, c2->c_text);
}
c2->c_text = add(buffer, c2->c_text);
}
+ mh_free0(&(p->pq_text));
+ mh_free0(&(p->pq_error));
}
c2->c_text = add("\n", c2->c_text);
}
c2->c_text = add("\n", c2->c_text);
for (c1 = *head; c1; c1 = c2) {
c2 = c1->c_next;
if (c1->c_name)
for (c1 = *head; c1; c1 = c2) {
c2 = c1->c_next;
if (c1->c_name)
+ mh_free0(&(c1->c_name));
+ mh_free0(&(c1->c_text));
+ mh_free0(&(c1->c_ovtxt));
+ mh_free0(&(c1->c_fstr));
- free((char *) c1->c_fmt);
- free((char *) c1);
+ mh_free0(&(c1->c_fmt));
+ mh_free0(&c1);
for (ctp = cts; *ctp; ctp++)
free_content(*ctp);
for (ctp = cts; *ctp; ctp++)
free_content(*ctp);
- free((char *) cts);
- cts = NULL;
/* If reading from a folder, do some updating */
if (mp) {
/* If reading from a folder, do some updating */
if (mp) {
char *dp;
dp = trimcpy(cp = getcpy(ct->c_descr));
char *dp;
dp = trimcpy(cp = getcpy(ct->c_descr));
dp = trimcpy(cp = add(ci->ci_comment, NULL));
free (cp);
snprintf(buffer, sizeof(buffer), "(%s)", dp);
dp = trimcpy(cp = add(ci->ci_comment, NULL));
free (cp);
snprintf(buffer, sizeof(buffer), "(%s)", dp);
printf(LSTFMT2d2, buffer);
}
}
printf(LSTFMT2d2, buffer);
}
}
ep = concat("Create directory \"", file, "\"? ", NULL);
answer = getanswer(ep);
ep = concat("Create directory \"", file, "\"? ", NULL);
answer = getanswer(ep);
if (!answer)
goto losing_directory;
if (!answer)
goto losing_directory;
if (errs) {
fflush(stdout);
fprintf(stderr, "%s", errs);
if (errs) {
fflush(stdout);
fprintf(stderr, "%s", errs);
- free(errs);
- errs = NULL;
*cp = '\0';
newbuf = concat(prefix, insertion, suffix,
"\n", NULL);
*cp = '\0';
newbuf = concat(prefix, insertion, suffix,
"\n", NULL);
} else {
/* Append to end. */
newbuf = concat(buf, insertion, "\n", NULL);
}
} else {
/* Append to end. */
newbuf = concat(buf, insertion, "\n", NULL);
}
- free(prefix);
- free(insertion);
- free(buf);
+ mh_free0(&prefix);
+ mh_free0(&insertion);
+ mh_free0(&buf);
+ mh_free0(&name_plus_equal);
char *name_suffix_equals = strstr(value, name_suffix_plus_quote);
char *cp;
char *name_suffix_equals = strstr(value, name_suffix_plus_quote);
char *cp;
- free(name_suffix_plus_quote);
+ mh_free0(&name_suffix_plus_quote);
if (name_suffix_equals) {
char *name_suffix_begin;
if (name_suffix_equals) {
char *name_suffix_begin;
*/
if (magic && *cp == '<') {
if (ct->c_id) {
*/
if (magic && *cp == '<') {
if (ct->c_id) {
- free(ct->c_id);
- ct->c_id = NULL;
}
if (!(dp = strchr(ct->c_id = ++cp, '>'))) {
advise(NULL, "invalid ID in message %s", ct->c_file);
}
if (!(dp = strchr(ct->c_id = ++cp, '>'))) {
advise(NULL, "invalid ID in message %s", ct->c_file);
if (istype) {
if ((dp = ci->ci_comment)) {
ci->ci_comment = concat(dp, " ", buffer, NULL);
if (istype) {
if ((dp = ci->ci_comment)) {
ci->ci_comment = concat(dp, " ", buffer, NULL);
} else {
ci->ci_comment = getcpy(buffer);
}
} else {
ci->ci_comment = getcpy(buffer);
}
continue;
*next = NULL;
free_content(p);
continue;
*next = NULL;
free_content(p);
*next = NULL;
/* free array of pointers */
*next = NULL;
/* free array of pointers */
adios(EX_IOERR, ce->ce_file, "unable to rename %s to ",
file_org);
}
adios(EX_IOERR, ce->ce_file, "unable to rename %s to ",
file_org);
}
} else {
ce->ce_file = add(cp, ce->ce_file);
} else {
ce->ce_file = add(cp, ce->ce_file);
adios(EX_IOERR, ce->ce_file, "unable to rename %s to ",
file_org);
}
adios(EX_IOERR, ce->ce_file, "unable to rename %s to ",
file_org);
}
} else {
ce->ce_file = add(cp, ce->ce_file);
} else {
ce->ce_file = add(cp, ce->ce_file);
adios(EX_IOERR, ce->ce_file, "unable to rename %s to ",
file_org);
}
adios(EX_IOERR, ce->ce_file, "unable to rename %s to ",
file_org);
}
} else {
ce->ce_file = add(cp, ce->ce_file);
} else {
ce->ce_file = add(cp, ce->ce_file);
adios(EX_USAGE, NULL, "missing argument to %s",
argp[-2]);
if (formsw)
adios(EX_USAGE, NULL, "missing argument to %s",
argp[-2]);
if (formsw)
formsw = getcpy(etcpath(cp));
continue;
formsw = getcpy(etcpath(cp));
continue;
for (ctp = cts; *ctp; ctp++)
free_content(*ctp);
for (ctp = cts; *ctp; ctp++)
free_content(*ctp);
- free((char *) cts);
- cts = NULL;
/* If reading from a folder, do some updating */
if (mp) {
/* If reading from a folder, do some updating */
if (mp) {
s = trimcpy(ct->c_descr);
strncpy(bp, s, buflen);
s = trimcpy(ct->c_descr);
strncpy(bp, s, buflen);
s = trimcpy(ct->c_descr);
strncpy(bp, s, buflen);
s = trimcpy(ct->c_descr);
strncpy(bp, s, buflen);
for (ctp = cts; *ctp; ctp++)
free_content(*ctp);
for (ctp = cts; *ctp; ctp++)
free_content(*ctp);
- free((char *) cts);
- cts = NULL;
/* If reading from a folder, do some updating */
if (mp) {
/* If reading from a folder, do some updating */
if (mp) {
ct = *ctq++;
if (store_content(ct, NULL) == NOTOK) {
losing:
ct = *ctq++;
if (store_content(ct, NULL) == NOTOK) {
losing:
ct->c_folder = getcpy(folder);
if (cp[1])
ct->c_folder = getcpy(folder);
if (cp[1])
for (ctp = cts; *ctp; ctp++)
free_content(*ctp);
for (ctp = cts; *ctp; ctp++)
free_content(*ctp);
- free((char *) cts);
- cts = NULL;
/* If reading from a folder, do some updating */
if (mp) {
/* If reading from a folder, do some updating */
if (mp) {
} else {
old_msgnums = msgnums;
msgnums = concat(old_msgnums, " ", this_msgnums, (void *)NULL);
} else {
old_msgnums = msgnums;
msgnums = concat(old_msgnums, " ", this_msgnums, (void *)NULL);
- free(old_msgnums);
- free(this_msgnums);
+ mh_free0(&old_msgnums);
+ mh_free0(&this_msgnums);
} else {
/* and here */
if (seq_in_list(name, sequences)) {
} else {
/* and here */
if (seq_in_list(name, sequences)) {
} else {
old_msgnums = msgnums;
msgnums = concat(old_msgnums, " ", this_msgnums, (void *)NULL);
} else {
old_msgnums = msgnums;
msgnums = concat(old_msgnums, " ", this_msgnums, (void *)NULL);
- free(old_msgnums);
- free(this_msgnums);
+ mh_free0(&old_msgnums);
+ mh_free0(&this_msgnums);
case FLD:
case FLDPLUS:
if (bp != NULL) {
case FLD:
case FLDPLUS:
if (bp != NULL) {
}
bp = getcpy(buf);
while (state == FLDPLUS) {
}
bp = getcpy(buf);
while (state == FLDPLUS) {
if (state == LENERR || state == FMTERR)
advise(NULL, "format error in message %d", msgnum);
if (bp != NULL)
if (state == LENERR || state == FMTERR)
advise(NULL, "format error in message %d", msgnum);
if (bp != NULL)
: (twsort(tw, &n->n_tws) < 0);
if (bp != NULL)
: (twsort(tw, &n->n_tws) < 0);
if (bp != NULL)
for (nxtbuf = compbuffers, i = ncomps; (cptr = *savecomp++);
nxtbuf++, i--) {
for (nxtbuf = compbuffers, i = ncomps; (cptr = *savecomp++);
nxtbuf++, i--) {
+ mh_free0(&(cptr->c_text));
- free(compbuffers);
- free(used_buf);
+ mh_free0(&compbuffers);
+ mh_free0(&used_buf);
cp = getcpy(m_name(msgnum));
if (m_file(cp, folders, foldp, !linkf))
exit(EX_IOERR);
cp = getcpy(m_name(msgnum));
if (m_file(cp, folders, foldp, !linkf))
exit(EX_IOERR);
if (sp != cptr->c_text) {
cp = cptr->c_text;
cptr->c_text = getcpy(sp);
if (sp != cptr->c_text) {
cp = cptr->c_text;
cptr->c_text = getcpy(sp);
}
}
i = format_len + char_read + 256;
}
}
i = format_len + char_read + 256;
}
/* return dynamically allocated buffers */
}
/* return dynamically allocated buffers */
for (nxtbuf = compbuffers, i = ncomps; (cptr = *savecomp++);
nxtbuf++, i--)
for (nxtbuf = compbuffers, i = ncomps; (cptr = *savecomp++);
nxtbuf++, i--)
- free(cptr->c_text); /* if not nxtbuf, nxtbuf already freed */
+ mh_free0(&(cptr->c_text)); /* if not nxtbuf, nxtbuf already freed */
- free(*nxtbuf++); /* free unused nxtbufs */
- free((char *) compbuffers);
- free((char *) used_buf);
+ mh_free0(nxtbuf++); /* free unused nxtbufs */
+ mh_free0(&compbuffers);
+ mh_free0(&used_buf);
}
static char *buf; /* our current working buffer */
}
static char *buf; /* our current working buffer */
#include <unistd.h>
#include <dirent.h>
#include <locale.h>
#include <unistd.h>
#include <dirent.h>
#include <locale.h>
cp = concat("Remove folder \"", folder, "\"? ", NULL);
if (!getanswer(cp))
exit(EX_OK);
cp = concat("Remove folder \"", folder, "\"? ", NULL);
if (!getanswer(cp))
exit(EX_OK);
}
if (rmf(folder) == OK) {
}
if (rmf(folder) == OK) {
}
num_unseen_seq = i;
if (dp) {
}
num_unseen_seq = i;
if (dp) {
}
p->p_value = add(lp, cp);
}
}
p->p_value = add(lp, cp);
}
- free(slist);
- free(dlist);
+ mh_free0(&slist);
+ mh_free0(&dlist);
if (state == LENERR || state == FMTERR)
admonish(NULL, "format error in message %d (header #%d)", msg, compnum);
if (datecomp)
if (state == LENERR || state == FMTERR)
admonish(NULL, "format error in message %d (header #%d)", msg, compnum);
if (datecomp)
}
fclose(in);
if (datecomp)
}
fclose(in);
if (datecomp)
cp = add(buf, cp);
}
putfmt(name, cp, out);
cp = add(buf, cp);
}
putfmt(name, cp, out);
cp = getcpy(mp->m_gname);
cp = add(";", cp);
linepos = putone(cp, linepos, namelen);
cp = getcpy(mp->m_gname);
cp = add(";", cp);
linepos = putone(cp, linepos, namelen);
naddrs += n;
cmd = add("ali -list", NULL);
naddrs += n;
cmd = add("ali -list", NULL);
naddrs += n;
cmd = add("ali -list", NULL);
naddrs += n;
cmd = add("ali -list", NULL);
naddrs += n;
return naddrs ? 0 : 1;
naddrs += n;
return naddrs ? 0 : 1;
cp = add(buf, cp);
}
proc_hdr(name, cp);
cp = add(buf, cp);
}
proc_hdr(name, cp);