From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id CF51B1F93C for ; Wed, 16 Nov 2022 09:26:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1668590806; bh=zlVb2YSv+7UDCRaolXr7ubLVmPiGg47YVYailDcPEvo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=yBIP1cXFQsjf2ZDLEDFaaYy4Czmn3JZ3SZFC6cA7RQShKtX/gGQKWOIeVoYZ5JbSQ BBaIy72zGZ/FwhyXddeVmg4I5SPltj23eFV3yje39Yex2kancD8dPIAT7PyOjP8weQ 1bLubYuu3xEDGcQwC62HmfkWWLOwpteTYnAbBWHo= From: Eric Wong To: mwrap-perl@80x24.org Subject: [PATCH 1/6] avoid leaking array returned by backtrace_symbols() Date: Wed, 16 Nov 2022 09:26:41 +0000 Message-Id: <20221116092646.19919-2-e@80x24.org> In-Reply-To: <20221116092646.19919-1-e@80x24.org> References: <20221116092646.19919-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Oops :x Fortunately, most allocations are tracked to a Perl location and the non-Perl code path is infrequently hit. --- Mwrap.xs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mwrap.xs b/Mwrap.xs index d5336fa..8aeb425 100644 --- a/Mwrap.xs +++ b/Mwrap.xs @@ -20,8 +20,8 @@ static SV *location_string(struct src_loc *l) char **s = backtrace_symbols((void *)l->k, 1); ret = newSVpvn(s[0], strlen(s[0])); - } - else { + free(s); + } else { ret = newSVpvn(l->k, l->capa - 1); }