From: Ralph Corderoy Date: Fri, 21 Oct 2016 22:21:30 +0000 (+0100) Subject: Replace `if (p) free(p)' with `mh_xfree(p)'. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/b36be1d314b4619fdc66cd2f22a1527b3672adfc?hp=db9af98fd5699ef5b61444132adc82cb6123882a Replace `if (p) free(p)' with `mh_xfree(p)'. --- diff --git a/uip/mhfree.c b/uip/mhfree.c index 4fb46da7..8f4f150f 100644 --- a/uip/mhfree.c +++ b/uip/mhfree.c @@ -9,6 +9,7 @@ */ #include +#include #include #include @@ -48,20 +49,10 @@ free_content (CT ct) */ free_header (ct); - if (ct->c_partno) { - free (ct->c_partno); - ct->c_partno = NULL; - } - - if (ct->c_vrsn) { - free (ct->c_vrsn); - ct->c_vrsn = NULL; - } - - if (ct->c_ctline) { - free (ct->c_ctline); - ct->c_ctline = NULL; - } + mh_xfree(ct->c_partno); + mh_xfree(ct->c_vrsn); + mh_xfree(ct->c_ctline); + ct->c_partno = ct->c_vrsn = ct->c_ctline = NULL; free_ctinfo (ct); @@ -91,43 +82,22 @@ free_content (CT ct) break; } - if (ct->c_showproc) { - free (ct->c_showproc); - ct->c_showproc = NULL; - } - if (ct->c_termproc) { - free (ct->c_termproc); - ct->c_termproc = NULL; - } - if (ct->c_storeproc) { - free (ct->c_storeproc); - ct->c_storeproc = NULL; - } + mh_xfree(ct->c_showproc); + mh_xfree(ct->c_termproc); + mh_xfree(ct->c_storeproc); + ct->c_showproc = ct->c_termproc = ct->c_storeproc = NULL; - if (ct->c_celine) { - free (ct->c_celine); - ct->c_celine = NULL; - } + mh_xfree(ct->c_celine); + ct->c_celine = NULL; /* free structures for content encodings */ free_encoding (ct, 1); - if (ct->c_id) { - free (ct->c_id); - ct->c_id = NULL; - } - if (ct->c_descr) { - free (ct->c_descr); - ct->c_descr = NULL; - } - if (ct->c_dispo) { - free (ct->c_dispo); - ct->c_dispo = NULL; - } - if (ct->c_dispo_type) { - free (ct->c_dispo_type); - ct->c_dispo_type = NULL; - } + mh_xfree(ct->c_id); + mh_xfree(ct->c_descr); + mh_xfree(ct->c_dispo); + mh_xfree(ct->c_dispo_type); + ct->c_id = ct->c_descr = ct->c_dispo = ct->c_dispo_type = NULL; free_pmlist (&ct->c_dispo_first); if (ct->c_file) {