From patchwork Fri Dec 8 09:16:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnold Robbins X-Patchwork-Id: 24807 Received: (qmail 102339 invoked by alias); 8 Dec 2017 09:21:56 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 102257 invoked by uid 89); 8 Dec 2017 09:21:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, MANY_HDRS_LCASE, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=HContent-type:text, Hx-spam-relays-external:ESMTPA X-HELO: mxout4.netvision.net.il MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII From: Arnold Robbins Message-id: <201712080916.vB89GxEG005501@skeeve.com> Date: Fri, 08 Dec 2017 11:16:59 +0200 To: carlos@redhat.com, libc-alpha@sourceware.org Subject: [PATCH 06/17] Regex: Use re_malloc / re_free consistently. User-Agent: Heirloom mailx 12.5 6/20/10 This patch changes several calls to malloc/free into re_malloc/re_free, bringing consistency to the code. 2017-11-27 Arnold D. Robbins * posix/regexec.c (buid_trtable): Use re_malloc/re_free instead of malloc/free. (match_ctx_clean): Ditto. diff --git a/posix/regexec.c b/posix/regexec.c index a0d9736..2d2bc46 100644 --- a/posix/regexec.c +++ b/posix/regexec.c @@ -3296,7 +3296,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) if (BE (ndests <= 0, 0)) { if (dests_node_malloced) - free (dests_alloc); + re_free (dests_alloc); /* Return 0 in case of an error, 1 otherwise. */ if (ndests == 0) { @@ -3328,18 +3328,18 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) else #endif { - dest_states = (re_dfastate_t **) - malloc (ndests * 3 * sizeof (re_dfastate_t *)); + dest_states = + re_malloc (re_dfastate_t *, ndests * 3); if (BE (dest_states == NULL, 0)) { out_free: if (dest_states_malloced) - free (dest_states); + re_free (dest_states); re_node_set_free (&follows); for (i = 0; i < ndests; ++i) re_node_set_free (dests_node + i); if (dests_node_malloced) - free (dests_alloc); + re_free (dests_alloc); return 0; } dest_states_malloced = true; @@ -3470,14 +3470,14 @@ out_free: } if (dest_states_malloced) - free (dest_states); + re_free (dest_states); re_node_set_free (&follows); for (i = 0; i < ndests; ++i) re_node_set_free (dests_node + i); if (dests_node_malloced) - free (dests_alloc); + re_free (dests_alloc); return 1; } @@ -4141,7 +4141,7 @@ match_ctx_clean (re_match_context_t *mctx) re_free (top->path->array); re_free (top->path); } - free (top); + re_free (top); } mctx->nsub_tops = 0;