Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp115342pxb; Thu, 12 Aug 2021 12:06:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgNYhpomIuFTWULL+kOHyQepMSrK4uyQLGc0aXanfA58xzpj4z1lrFP4CwtE9kPcZvtipM X-Received: by 2002:a17:906:410c:: with SMTP id j12mr5088348ejk.553.1628795195230; Thu, 12 Aug 2021 12:06:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628795195; cv=none; d=google.com; s=arc-20160816; b=X3uSp64gwW19zERr9FrD2O7XAiaEA6g6sTJrcNOSK2uzMbbG7EjVleCEU/0hNLYjS9 Papee2GQ/6/5FB3UwFSzat5v4F3vKWRWSF3Jeo4VWBLmVNIBPlP1MNWGDyNdOSFQJRyf FoJf1zg8PgkJsMNGV7/CxZD34YAxoFMnG6Lx/VCEKbZEtzJx+y79qb/xW2+zrh9tBdvt 0wnTJ9/Cjf6uKnk69ktKjJpPJ7UgmSWtQqqnVj0WHMDOCY76led4fFE6/zi1x3ZAzDGa 2yb3aBw1KsBn9fB63ELuZmrf7a8aWBMdmyCwSSLsNedWXa2ChOorDw1fTMrHB3BJLILI B2vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=l/0n0I5NVe0nOUsA4hiX7etJRdh0G8SF+YX9GRQaal8=; b=EXTgb543PqyqDGELHvCxnF0cAwBw6E58t8DNwBEuNOc0or8S0U86/oSUDGPxsdfHuB scKe3JDIxFgtOfO3o62UnIAL7Y3KnfvOoYcAZwYNRr5j2nAu+j99bqMmo5O+AX94e7EV pcR2WTNs3tve8ar/yVuoAj0x0TQWHpRiVul0NBo769G12FxbQ9nRp7gvPMlxk/CNTmzJ 3Epe7CFeIrHjd4aIb8IBdBuTRccZPqdlchj9ExS+Rlf9sucqESGtlyZaCoyP++y233xu y/3vZetRWNxL9TCiTwqhE42sc5lVmF4xYQ6/DjKsZM1LuXECOGaVh5Uz6byv+4A+5WjA R17A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WHaBNi2P; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qo8si3222945ejb.637.2021.08.12.12.06.10; Thu, 12 Aug 2021 12:06:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WHaBNi2P; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237523AbhHLSN6 (ORCPT + 99 others); Thu, 12 Aug 2021 14:13:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37648 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237510AbhHLSN6 (ORCPT ); Thu, 12 Aug 2021 14:13:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628792012; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l/0n0I5NVe0nOUsA4hiX7etJRdh0G8SF+YX9GRQaal8=; b=WHaBNi2P9/BsM91b3Mo7yeeXQYTLCpAaU+p1hMjcx9fouZHMXtdDXl7OKBBNpoXN/haJoT BjftT81VvAVGzKabAmzu9SOghLVvMuvMBe8kWM6EC+Cw9bnMh/UlDlHImXcj5yl6Kwl3xY DEIjKM1w+5pGt/yiDRzn+mHpCZ6zDcc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-86-jJJKsq1UOMy1XfY8_YLjbw-1; Thu, 12 Aug 2021 14:13:31 -0400 X-MC-Unique: jJJKsq1UOMy1XfY8_YLjbw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 462F2801B3D for ; Thu, 12 Aug 2021 18:13:30 +0000 (UTC) Received: from ajmitchell.com (unknown [10.39.192.151]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3BBC960657; Thu, 12 Aug 2021 18:13:29 +0000 (UTC) From: Alice Mitchell To: linux-nfs@vger.kernel.org Cc: steved@redhat.com, Alice Mitchell Subject: [PATCH 4/4 v2] nfs-utils: Fix mem leak in mountd Date: Thu, 12 Aug 2021 19:13:19 +0100 Message-Id: <20210812181319.3885781-5-ajmitchell@redhat.com> In-Reply-To: <20210812181319.3885781-1-ajmitchell@redhat.com> References: <20210812181319.3885781-1-ajmitchell@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org leak of mountlist struct and content on error Signed-off-by: Alice Mitchell --- utils/mountd/rmtab.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils/mountd/rmtab.c b/utils/mountd/rmtab.c index 2da9761..752fdb6 100644 --- a/utils/mountd/rmtab.c +++ b/utils/mountd/rmtab.c @@ -233,6 +233,9 @@ mountlist_list(void) m->ml_directory = strdup(rep->r_path); if (m->ml_hostname == NULL || m->ml_directory == NULL) { + free(m->ml_hostname); + free(m->ml_directory); + free(m); mountlist_freeall(mlist); mlist = NULL; xlog(L_ERROR, "%s: memory allocation failed", -- 2.27.0