void *mh_xrealloc(void *, size_t);
void *mh_xcalloc(size_t, size_t);
+void mh_free0(void *);
char *pwd(void);
char *add(char *, char *);
void create_folder(char *, int, void (*)(int));
return;
if (mp->m_text)
- free(mp->m_text);
+ mh_free0(&(mp->m_text));
if (mp->m_pers)
- free(mp->m_pers);
+ mh_free0(&(mp->m_pers));
if (mp->m_mbox)
- free(mp->m_mbox);
+ mh_free0(&(mp->m_mbox));
if (mp->m_host)
- free(mp->m_host);
+ mh_free0(&(mp->m_host));
if (mp->m_path)
- free(mp->m_path);
+ mh_free0(&(mp->m_path));
if (mp->m_gname)
- free(mp->m_gname);
+ mh_free0(&(mp->m_gname));
if (mp->m_note)
- free(mp->m_note);
+ mh_free0(&(mp->m_note));
- free((char *) mp);
+ mh_free0(&mp);
}
while (first->m_next != NULL && first->m_next != next) {
mp = first->m_next;
first->m_next = mp->m_next;
- free(mp);
+ mh_free0(&mp);
}
first->m_next = next;
return -1;
*/
#include <h/mh.h>
+#include <h/utils.h>
/*
** Delete a key/value pair from the context/profile list.
pp->n_next = np->n_next;
else
m_defs = np->n_next;
- free(np->n_name);
+ mh_free0(&(np->n_name));
if (np->n_field)
- free(np->n_field);
- free((char *) np);
+ mh_free0(&(np->n_field));
+ mh_free0(&np);
ctxflags |= CTXMOD;
return 0;
}
*/
#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>
if (!getanswer(cp)) {
adios(EX_NOPERM, NULL, "Unable to access the mail storage directory `%s'", nd);
}
- free(cp);
+ mh_free0(&cp);
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)
- free(np->n_field);
+ mh_free0(&(np->n_field));
np->n_field = getcpy(value);
ctxflags |= CTXMOD;
}
/* add_folder saves child in the list, don't free it */
add_folder(child, crawl);
} else {
- free(child);
+ mh_free0(&child);
}
}
closedir(dd);
- free(prefix);
+ mh_free0(&prefix);
}
static void
** 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);
}
}
*q = '\0';
- free(*value);
+ mh_free0(value);
*value = output;
return 0;
}
*p = '\0';
- free(*value);
+ mh_free0(value);
*value = str;
}
output = add(cp, output);
column += len;
- free(cp);
- cp = NULL;
+ mh_free0(&cp);
}
/*
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;
size_t i;
if (format_string)
- free(format_string);
+ mh_free0(&format_string);
format_string = getcpy(fstring);
usr_fstring = fstring;
FILE *fp;
if (formats) {
- free(formats);
+ mh_free0(&formats);
}
if (form) {
if (!dstlen || !savedstlen)
goto buffull;
dstlen = savedstlen;
- free(convbuf);
+ mh_free0(&convbuf);
}
#endif
*/
#include <h/mh.h>
-
+#include <h/utils.h>
void
folder_free(struct msgs *mp)
return;
if (mp->foldpath)
- free(mp->foldpath);
+ mh_free0(&(mp->foldpath));
/* free the sequence names */
for (i = 0; mp->msgattrs[i]; i++)
- free(mp->msgattrs[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))) {
- free(name);
+ mh_free0(&name);
return NULL;
}
if (stat(name, &st) == -1) {
- free(name);
+ mh_free0(&name);
closedir(dd);
return NULL;
}
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.
tmpstats[msgnum - lo] = mp->msgstats[msgnum - mp->lowoff];
}
}
- free(mp->msgstats);
+ mh_free0(&(mp->msgstats));
mp->msgstats = tmpstats;
}
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);
}
- free(folder);
+ mh_free0(&folder);
/*
** Make sure we have enough message status space for all
struct adrx *adrxp = &adrxs2;
if (pers)
- free(pers);
+ mh_free0(&pers);
if (mbox)
- free(mbox);
+ mh_free0(&mbox);
if (host)
- free(host);
+ mh_free0(&host);
if (path)
- free(path);
+ mh_free0(&path);
if (grp)
- free(grp);
+ mh_free0(&grp);
if (note)
- free(note);
- pers = mbox = host = path = grp = note = NULL;
+ mh_free0(¬e);
err[0] = 0;
if (dp == NULL) {
dp = cp = getcpy(addrs ? addrs : "");
glevel = 0;
} else if (cp == NULL) {
- free(dp);
- dp = NULL;
+ mh_free0(&dp);
return NULL;
}
switch (parse_address()) {
case DONE:
- free(dp);
- dp = cp = NULL;
+ mh_free0(&dp);
+ cp = NULL;
return NULL;
case OK:
}
case LX_COMA:
if (note) {
- free(note);
- note = NULL;
+ mh_free0(¬e);
}
goto again;
case LX_AT: /* sigh (0) */
mbox = add(host, add("%", mbox));
- free(host);
- host = NULL;
+ mh_free0(&host);
continue;
default:
cp = add(field, cp);
}
np->n_field = trimcpy(cp);
- free(cp);
+ mh_free0(&cp);
} else {
np->n_field = trimcpy(field);
}
cp = add(field, cp);
}
seq_init(mp, getcpy(name), trimcpy(cp));
- free(cp);
+ mh_free0(&cp);
} else {
seq_init(mp, getcpy(name), trimcpy(field));
}
/* Return error, if too many sequences */
if (i >= NUMATTRS) {
- free(name);
- free(field);
+ mh_free0(&name);
+ mh_free0(&field);
return -1;
}
** name string. Else add it to the list of sequence names.
*/
if (mp->msgattrs[i]) {
- free(name);
+ mh_free0(&name);
} 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 */
return i;
}
*/
#include <h/mh.h>
+#include <h/utils.h>
/*
** Add all the messages currently SELECTED to
if ((cp = context_find(psequence))) {
dp = getcpy(cp);
if (!(ap = brkstring(dp, " ", "\n")) || !*ap) {
- free(dp);
+ mh_free0(&dp);
return;
}
} else {
for (; *ap; ap++)
seq_addsel(mp, *ap, -1, 1);
- free(dp);
+ mh_free0(&dp);
}
*/
#include <h/mh.h>
+#include <h/utils.h> /* mh_free0() */
/*
** 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 */
- free(dp);
+ mh_free0(&dp);
return;
}
}
}
- free(dp);
+ mh_free0(&dp);
}
}
/*
+** 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.
*/
/* Copy s1 and free it */
if (s1) {
memcpy(cp, s1, len1);
- free(s1);
+ mh_free0(&s1);
}
/* Copy s2 */
if (!getanswer(cp)) {
done_callback(EX_CANTCREAT);
}
- free(cp);
+ mh_free0(&cp);
} else if (autocreate == -1) {
/* do not create, so exit */
done_callback(EX_CANTCREAT);
}
}
if (dp) {
- free(dp);
+ mh_free0(&dp);
}
}
print_aka(vp ? vp : s, list, 0);
if (vp)
- free(vp);
+ mh_free0(&vp);
}
if (cp) {
dp = cp;
cp = concat(cp, ",", pp, NULL);
- free(dp);
- free(pp);
+ mh_free0(&dp);
+ mh_free0(&pp);
} else
cp = pp;
}
} while (*field && *field != '-');
- free(field);
+ mh_free0(&field);
fclose(fp);
return;
} while (*field && *field != '-');
- free(field);
+ mh_free0(&field);
fflush(tmp);
fflush(fp); /* The underlying fd will be closed by lkclose() */
fmt_scan(fmt, buffer, BUFSIZ, dat);
fputs(buffer, stdout);
- free(p->pq_text);
+ mh_free0(&(p->pq_text));
if (p->pq_error)
- free(p->pq_error);
+ mh_free0(&(p->pq_error));
q = p->pq_next;
- free((char *) p);
+ mh_free0(&p);
}
return status;
}
}
- free(smsgs);
+ mh_free0(&smsgs);
context_replace(curfolder, folder);
/*
}
return NOTOK;
}
- free(resent);
+ mh_free0(&resent);
if (txtfd != NOTOK) {
lseek(txtfd, (off_t) 0, SEEK_SET); /* msgnam not accurate */
}
for (cp = getcpy(getcurfol()); *ap; ap++)
cp = add(*ap, add(" ", cp));
- free(dp);
+ mh_free0(&dp);
context_replace(stack, cp); /* update folder stack */
} else {
/* update folder stack */
/* delete folder stack entry from context */
context_del(stack);
}
- free(dp);
+ mh_free0(&dp);
}
if (pushsw || popsw) {
cp = toabsdir(argfolder);
dp = getcpy(cp);
for (ap = brkstring(dp, " ", "\n"); *ap; ap++)
printf(" %s", *ap);
- free(dp);
+ mh_free0(&dp);
}
printf("\n");
line = mh_xcalloc(fmtsize, sizeof(char));
fmt_scan(fmt, line, fmtsize, dat);
fputs(line, tmp);
- free(line);
+ mh_free0(&line);
if (fclose(tmp))
adios(EX_IOERR, tmpfil, "error writing");
*/
break;
}
- free(maildir_copy);
+ mh_free0(&maildir_copy);
if (incerr < 0) { /* error */
if (locked) {
if (!*cp)
adios(EX_DATAERR, NULL, "empty pipe command for #%s directive", ci->ci_type);
cp = getcpy(cp);
- free(ci->ci_magic);
+ mh_free0(&(ci->ci_magic));
ci->ci_magic = cp;
} else {
/* record filename of decoded contents */
if (!m_convert(mp, cp))
exit(EX_USAGE);
}
- free(folder);
+ mh_free0(&folder);
free_ctinfo(ct);
/*
*/
#include <h/mh.h>
+#include <h/utils.h>
#include <errno.h>
#include <h/mime.h>
#include <h/mhparse.h>
free_header(ct);
if (ct->c_partno)
- free(ct->c_partno);
+ mh_free0(&(ct->c_partno));
if (ct->c_vrsn)
- free(ct->c_vrsn);
+ mh_free0(&(ct->c_vrsn));
if (ct->c_ctline)
- free(ct->c_ctline);
+ mh_free0(&(ct->c_ctline));
free_ctinfo(ct);
}
if (ct->c_charset)
- free(ct->c_charset);
+ mh_free0(&(ct->c_charset));
if (ct->c_showproc)
- free(ct->c_showproc);
+ mh_free0(&(ct->c_showproc));
if (ct->c_storeproc)
- free(ct->c_storeproc);
+ mh_free0(&(ct->c_storeproc));
if (ct->c_celine)
- free(ct->c_celine);
+ mh_free0(&(ct->c_celine));
/* free structures for content encodings */
free_encoding(ct, 1);
if (ct->c_id)
- free(ct->c_id);
+ mh_free0(&(ct->c_id));
if (ct->c_descr)
- free(ct->c_descr);
+ mh_free0(&(ct->c_descr));
if (ct->c_dispo)
- free(ct->c_dispo);
+ mh_free0(&(ct->c_dispo));
if (ct->c_file) {
if (ct->c_unlink)
unlink(ct->c_file);
- free(ct->c_file);
+ mh_free0(&(ct->c_file));
}
if (ct->c_fp)
fclose(ct->c_fp);
if (ct->c_storage)
- free(ct->c_storage);
+ mh_free0(&(ct->c_storage));
if (ct->c_folder)
- free(ct->c_folder);
+ mh_free0(&(ct->c_folder));
- free(ct);
+ mh_free0(&ct);
}
while (hp1) {
hp2 = hp1->next;
- free(hp1->name);
- free(hp1->value);
- free(hp1);
+ mh_free0(&(hp1->name));
+ mh_free0(&(hp1->value));
+ mh_free0(&hp1);
hp1 = hp2;
}
ci = &ct->c_ctinfo;
if (ci->ci_type) {
- free(ci->ci_type);
- ci->ci_type = NULL;
+ mh_free0(&(ci->ci_type));
}
if (ci->ci_subtype) {
- free(ci->ci_subtype);
- ci->ci_subtype = NULL;
+ mh_free0(&(ci->ci_subtype));
}
for (ap = ci->ci_attrs; *ap; ap++) {
- free(*ap);
- *ap = NULL;
+ mh_free0(ap);
}
if (ci->ci_comment) {
- free(ci->ci_comment);
- ci->ci_comment = NULL;
+ mh_free0(&(ci->ci_comment));
}
if (ci->ci_magic) {
- free(ci->ci_magic);
- ci->ci_magic = NULL;
+ mh_free0(&(ci->ci_magic));
}
}
if (!(t = (struct text *) ct->c_ctparams))
return;
- free((char *) t);
- ct->c_ctparams = NULL;
+ mh_free0(&t);
}
return;
if (m->mp_start)
- free(m->mp_start);
+ mh_free0(&(m->mp_start));
if (m->mp_stop)
- free(m->mp_stop);
+ mh_free0(&(m->mp_stop));
for (part = m->mp_parts; part; part = next) {
next = part->mp_next;
free_content(part->mp_part);
- free((char *) part);
+ mh_free0(&part);
}
- m->mp_parts = NULL;
- free((char *) m);
- ct->c_ctparams = NULL;
+ mh_free0(&m);
}
return;
if (p->pm_partid)
- free(p->pm_partid);
+ mh_free0(&(p->pm_partid));
- free((char *) p);
- ct->c_ctparams = NULL;
+ mh_free0(&p);
}
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));
}
if (toplevel) {
- free((char *) ce);
- ct->c_cefile = NULL;
+ mh_free0(&ce);
} else {
ct->c_ceopenfnx = NULL;
}
return 1;
cp = concat("=", cp, NULL);
fmtstr = new_fs(cp, NULL);
- free(cp);
+ mh_free0(&cp);
c1->c_fstr = getcpy(fmtstr);
c1->c_flags |= FORMAT;
return 0;
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)
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")) {
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)
/* Don't need to append a newline, dctime() already did */
c2->c_text = getcpy(buffer);
- free(ap);
+ mh_free0(&ap);
return;
}
c2->c_text = add(buffer, c2->c_text);
}
- free(p->pq_text);
+ mh_free0(&(p->pq_text));
if (p->pq_error)
- free(p->pq_error);
+ mh_free0(&(p->pq_error));
q = p->pq_next;
- free((char *) p);
+ mh_free0(&p);
}
c2->c_text = add("\n", c2->c_text);
for (c1 = *head; c1; c1 = c2) {
c2 = c1->c_next;
if (c1->c_name)
- free(c1->c_name);
+ mh_free0(&(c1->c_name));
if (c1->c_text)
- free(c1->c_text);
+ mh_free0(&(c1->c_text));
if (c1->c_ovtxt)
- free(c1->c_ovtxt);
+ mh_free0(&(c1->c_ovtxt));
if (c1->c_fstr)
- free(c1->c_fstr);
+ mh_free0(&(c1->c_fstr));
if (c1->c_fmt)
- free((char *) c1->c_fmt);
- free((char *) c1);
+ mh_free0(&(c1->c_fmt));
+ mh_free0(&c1);
}
*head = *tail = NULL;
for (ctp = cts; *ctp; ctp++)
free_content(*ctp);
- free((char *) cts);
- cts = NULL;
+ mh_free0(&cts);
/* If reading from a folder, do some updating */
if (mp) {
char *dp;
dp = trimcpy(cp = getcpy(ct->c_descr));
- free(cp);
+ mh_free0(&cp);
printf(LSTFMT2d1, dp);
- free(dp);
+ mh_free0(&dp);
}
printf("\n");
dp = trimcpy(cp = add(ci->ci_comment, NULL));
free (cp);
snprintf(buffer, sizeof(buffer), "(%s)", dp);
- free(dp);
+ mh_free0(&dp);
printf(LSTFMT2d2, buffer);
}
}
ep = concat("Create directory \"", file, "\"? ", NULL);
answer = getanswer(ep);
- free(ep);
+ mh_free0(&ep);
if (!answer)
goto losing_directory;
if (errs) {
fflush(stdout);
fprintf(stderr, "%s", errs);
- free(errs);
- errs = NULL;
+ mh_free0(&errs);
}
}
*cp = '\0';
newbuf = concat(prefix, insertion, suffix,
"\n", NULL);
- free(suffix);
+ mh_free0(&suffix);
} 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);
}
- free(name_plus_equal);
+ mh_free0(&name_plus_equal);
}
return newbuf;
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 (magic && *cp == '<') {
if (ct->c_id) {
- free(ct->c_id);
- ct->c_id = NULL;
+ mh_free0(&(ct->c_id));
}
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);
- free(dp);
+ mh_free0(&dp);
} else {
ci->ci_comment = getcpy(buffer);
}
continue;
*next = NULL;
free_content(p);
- free((char *) part);
+ mh_free0(&part);
}
}
*next = NULL;
/* free array of pointers */
- free((char *) base);
+ mh_free0(&base);
}
adios(EX_IOERR, ce->ce_file, "unable to rename %s to ",
file_org);
}
- free(file_org);
+ mh_free0(&file_org);
} else {
ce->ce_file = add(cp, ce->ce_file);
adios(EX_IOERR, ce->ce_file, "unable to rename %s to ",
file_org);
}
- free(file_org);
+ mh_free0(&file_org);
} else {
ce->ce_file = add(cp, ce->ce_file);
adios(EX_IOERR, ce->ce_file, "unable to rename %s to ",
file_org);
}
- free(file_org);
+ mh_free0(&file_org);
} else {
ce->ce_file = add(cp, ce->ce_file);
adios(EX_USAGE, NULL, "missing argument to %s",
argp[-2]);
if (formsw)
- free(formsw);
+ mh_free0(&formsw);
formsw = getcpy(etcpath(cp));
continue;
for (ctp = cts; *ctp; ctp++)
free_content(*ctp);
- free((char *) cts);
- cts = NULL;
+ mh_free0(&cts);
/* If reading from a folder, do some updating */
if (mp) {
s = trimcpy(ct->c_descr);
strncpy(bp, s, buflen);
- free(s);
+ mh_free0(&s);
}
break;
s = trimcpy(ct->c_descr);
strncpy(bp, s, buflen);
- free(s);
+ mh_free0(&s);
}
break;
for (ctp = cts; *ctp; ctp++)
free_content(*ctp);
- free((char *) cts);
- cts = NULL;
+ mh_free0(&cts);
/* If reading from a folder, do some updating */
if (mp) {
ct = *ctq++;
if (store_content(ct, NULL) == NOTOK) {
losing:
- free((char *) base);
+ mh_free0(&base);
return NOTOK;
}
goto losing;
}
- free((char *) base);
+ mh_free0(&base);
return OK;
}
ct->c_folder = getcpy(folder);
if (cp[1])
- free(folder);
+ mh_free0(&folder);
goto got_filename;
}
for (ctp = cts; *ctp; ctp++)
free_content(*ctp);
- free((char *) cts);
- cts = NULL;
+ mh_free0(&cts);
/* If reading from a folder, do some updating */
if (mp) {
}
}
- free(field);
+ mh_free0(&field);
return total;
}
} 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);
}
}
- free(cp);
+ mh_free0(&cp);
} else {
/* and here */
if (seq_in_list(name, sequences)) {
} 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) {
- free(bp);
- bp = NULL;
+ mh_free0(&bp);
}
bp = getcpy(buf);
while (state == FLDPLUS) {
if (state == LENERR || state == FMTERR)
advise(NULL, "format error in message %d", msgnum);
if (bp != NULL)
- free(bp);
+ mh_free0(&bp);
return 0;
default:
: (twsort(tw, &n->n_tws) < 0);
if (bp != NULL)
- free(bp);
+ mh_free0(&bp);
return state;
}
}
fclose(out);
- free(scanl);
+ mh_free0(&scanl);
for (nxtbuf = compbuffers, i = ncomps; (cptr = *savecomp++);
nxtbuf++, i--) {
- free(cptr->c_text);
+ mh_free0(&(cptr->c_text));
}
while (i-- > 0) {
- free(*nxtbuf++);
+ mh_free0(nxtbuf++);
}
- 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);
- free(cp);
+ mh_free0(&cp);
}
}
if (sp != cptr->c_text) {
cp = cptr->c_text;
cptr->c_text = getcpy(sp);
- free(cp);
+ mh_free0(&cp);
}
}
i = format_len + char_read + 256;
}
/* return dynamically allocated buffers */
- free(scanl);
+ mh_free0(&scanl);
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 */
while ( i-- > 0)
- 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 */
*/
#include <h/mh.h>
+#include <h/utils.h>
#include <unistd.h>
#include <dirent.h>
#include <locale.h>
cp = concat("Remove folder \"", folder, "\"? ", NULL);
if (!getanswer(cp))
exit(EX_OK);
- free(cp);
+ mh_free0(&cp);
}
if (rmf(folder) == OK) {
pp = np;
}
}
- free(cp);
+ mh_free0(&cp);
}
}
num_unseen_seq = i;
if (dp) {
- free(dp);
+ mh_free0(&dp);
}
}
}
p->p_value = add(lp, cp);
}
- free(lp);
+ mh_free0(&lp);
break;
}
}
}
}
*fp = 0;
- free(slist);
- free(dlist);
+ mh_free0(&slist);
+ mh_free0(&dlist);
dlist = flist;
}
if (state == LENERR || state == FMTERR)
admonish(NULL, "format error in message %d (header #%d)", msg, compnum);
if (datecomp)
- free(datecomp);
+ mh_free0(&datecomp);
if (subjcomp)
- free(subjcomp);
+ mh_free0(&subjcomp);
fclose(in);
return (0);
}
fclose(in);
if (datecomp)
- free(datecomp);
+ mh_free0(&datecomp);
return (1);
}
cp = add(buf, cp);
}
putfmt(name, cp, out);
- free(cp);
+ mh_free0(&cp);
continue;
case BODY:
cp = getcpy(mp->m_gname);
cp = add(";", cp);
linepos = putone(cp, linepos, namelen);
- free(cp);
+ mh_free0(&cp);
cp = NULL;
}
} else {
}
pclose(in);
}
- free(cmd);
+ mh_free0(&cmd);
naddrs += n;
cmd = add("ali -list", NULL);
}
pclose(in);
}
- free(cmd);
+ mh_free0(&cmd);
naddrs += n;
cmd = add("ali -list", NULL);
}
pclose(in);
}
- free(cmd);
+ mh_free0(&cmd);
naddrs += n;
return naddrs ? 0 : 1;
cp = add(buf, cp);
}
proc_hdr(name, cp);
- free(cp);
+ mh_free0(&cp);
continue;
case BODY: