From patchwork Sat Jan 29 00:44:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dmitry V. Levin" X-Patchwork-Id: 12729333 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FFFCC433FE for ; Sat, 29 Jan 2022 00:44:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233942AbiA2AoT (ORCPT ); Fri, 28 Jan 2022 19:44:19 -0500 Received: from vmicros1.altlinux.org ([194.107.17.57]:47468 "EHLO vmicros1.altlinux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232089AbiA2AoT (ORCPT ); Fri, 28 Jan 2022 19:44:19 -0500 Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id A64F772C8FA; Sat, 29 Jan 2022 03:44:17 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 7ED837CCA9C; Sat, 29 Jan 2022 03:44:17 +0300 (MSK) Date: Sat, 29 Jan 2022 03:44:17 +0300 From: "Dmitry V. Levin" To: Steve Dickson Cc: libtirpc-devel@lists.sourceforge.net, linux-nfs@vger.kernel.org Subject: [PATCH] rpcbind: fix double free in init_transport Message-ID: <20220129004417.GA10610@altlinux.org> MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org $ rpcbind -h 127.0.0.1 free(): double free detected in tcache 2 Aborted Fixes: a6889bba949b ("Removed resource leaks from src/rpcbind.c") Resolves: https://sourceforge.net/p/rpcbind/bugs/6/ Signed-off-by: Dmitry V. Levin --- src/rpcbind.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rpcbind.c b/src/rpcbind.c index 25d8a90..ecebe97 100644 --- a/src/rpcbind.c +++ b/src/rpcbind.c @@ -552,8 +552,10 @@ init_transport(struct netconfig *nconf) syslog(LOG_ERR, "cannot bind %s on %s: %m", (hosts[nhostsbak] == NULL) ? "*" : hosts[nhostsbak], nconf->nc_netid); - if (res != NULL) + if (res != NULL) { freeaddrinfo(res); + res = NULL; + } continue; } else checkbind++;