Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp889518pxt; Fri, 6 Aug 2021 17:06:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySdBFIDRzPeTciebz3elfKOEL6H7LTN0A+Pn40rYDndqQgsjGN/HZkuSrHChr0JvZtCnwg X-Received: by 2002:a92:b741:: with SMTP id c1mr250131ilm.220.1628294779437; Fri, 06 Aug 2021 17:06:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628294779; cv=none; d=google.com; s=arc-20160816; b=HIWFBxwvyq2Wn1Jfo84figMHSF+C+AkqDj/+AYOmvSKn4q4ssRcAoDyFeni1ZgnXuC VGZMJigN5ACJnVcPtGet1C2KfW6W2o6pd3ZhuAtHz1Zr3iqyEG/NWujas2ahF5eYCpeP FjYc2IDHpd5TvlROpJS0OS12/9ks0Y0yHybuWvznq7IzqnWSMVaBsJrB29hkiiRcl1SP NfJ14bGD7rw50KUwb+mhVgdLWolvSjOAe+18wxcxORrinqTkbfJeFyFgXzBVDpYaQ59E iFVkhIDSCHOzex3WjsMKU5b7AOe5k4XgpyFsnKOPpPBKr/WnVPx5uee+A8BBv/9EMGqm H2Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=M8TPBrLeahG3PU+HlKP+EzZ3APv60mD018i2Qe5LF3A=; b=l3qxRw6Y5ZukTavDgPA6rgxkxx5T5rn1kyOaKdiplWQ0P/BED/JeWF6mVXfRhmPk1G ahToUhn2/9nk2R3hKQ6U1TFKdKTalXnJOACOec6UrcEt/3V2olcb1Z1CS8M4hkl95did nRYTc4nw/FpkifcESyVjg13AhmIMH8zpDOmdjEfXDTxmictVZWlSOV47xaAhqTTH148U 0HtVCuC6lh3C7I1PSsmWOsZHbM6zt89NE4FA1NuhGTBnJPpu9v60EO4ob0/zTgW70U++ Am+cIWHpiw5W6+98SjpAgvKZWE18QdJwTBHt7jMuo03wHkELLri6to/3T2fUrLkvBj0e rOUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umich.edu header.s=google-2016-06-03 header.b=UfndfxCS; 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=umich.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q17si10657895ilj.42.2021.08.06.17.06.07; Fri, 06 Aug 2021 17:06:19 -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=@umich.edu header.s=google-2016-06-03 header.b=UfndfxCS; 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=umich.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243819AbhHFTP3 (ORCPT + 99 others); Fri, 6 Aug 2021 15:15:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243805AbhHFTP3 (ORCPT ); Fri, 6 Aug 2021 15:15:29 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED9D1C0613CF for ; Fri, 6 Aug 2021 12:15:11 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id g21so14514421edb.4 for ; Fri, 06 Aug 2021 12:15:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umich.edu; s=google-2016-06-03; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=M8TPBrLeahG3PU+HlKP+EzZ3APv60mD018i2Qe5LF3A=; b=UfndfxCSDP/pKTtT4FSlU9HhUsx8rj6Iv0RpBpifOJhKLpABhyrSNMFwiSp3OcQtxD 1v/SN6zf+u4cp0LH8HUcj7hd1AAh9z8QudEmHVcYRuX1pbI58uTatpLaQO4XYgRgBYB/ Nzy84TYnmX9WhoW+VglVMjMg0PL1BrksYHNAqEq6zzoH71FpM5dT72EK4Rm/0pgk+kLw smZY2E6KI5gRRwp+zZOa789dQsifboNzTap2+u1wsC8eW53joeWYKK75a+GyvKN1S2QD rkSTEkFUrtSPRTaRLtaNmNJcVxpps57ghqx6PNUsufS6U8TrPaqYfnMkD1riyjFAuH3Z GlYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=M8TPBrLeahG3PU+HlKP+EzZ3APv60mD018i2Qe5LF3A=; b=NzwJexRPucElCnp8S9zLVhgwNBDW2ihQJCuoUMg0Kz58r10DIJRtWRrzh7evJUuYRx CI4CENHJJdQTFzxpvd/KICM6Sz1ixKgCg6As0eKyZkz/NbD84xuX4xZqrpPwYAFcfwKr bisFYC2cN/9VHtLCswP/rVpfw5HBZNSI0/uitgT+wxyI44LYCCNB2NuhZtQRvOpmU7AH RguTUsWaXzX0kZOIO7KxgJ8IkxZOxuFXEbAHDrW0/hQopDzWfgsUZHIPxXuHu8YOTXCG BI1PrLmLEgpb8e3N4pUKSaZNVeiHIL0eoGBB4zFTiIe1grBQo7YQthN/n1ePyAzhLuJE cWdQ== X-Gm-Message-State: AOAM532O36vqFNgCd2FQLSxiyn9wcPM2qbWC9n51L0GgLizxfKyx4M+g OND8+gcI0QKebP6ABGxCZtJF9dvAmwR49Kde5N0= X-Received: by 2002:a05:6402:3128:: with SMTP id dd8mr15405265edb.367.1628277310533; Fri, 06 Aug 2021 12:15:10 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Olga Kornievskaia Date: Fri, 6 Aug 2021 15:14:59 -0400 Message-ID: Subject: Re: [PATCH 1/4] nfs-utils: Fix potential memory leaks in idmap To: Alice Mitchell Cc: linux-nfs , Steve Dickson Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Fri, Aug 6, 2021 at 12:21 PM Alice Mitchell wrote: > > > Signed-off-by: Alice Mitchell > --- > support/nfsidmap/nss.c | 4 ++-- > support/nfsidmap/regex.c | 1 + > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/support/nfsidmap/nss.c b/support/nfsidmap/nss.c > index 669760b..f00bd9b 100644 > --- a/support/nfsidmap/nss.c > +++ b/support/nfsidmap/nss.c > @@ -365,9 +365,9 @@ static int _nss_name_to_gid(char *name, gid_t *gid, > int dostrip) > out_buf: > free(buf); > out_name: > - if (dostrip) > + if (localname) > free(localname); > - if (get_reformat_group()) > + if (ref_name) > free(ref_name); Do we even need to check for null before freeing these days? man page says if null is passed then it's a no-op. If we are not allowed to free a null then there is another patch in the series in the mountd code that does intentionally do a free of null pointers. > out: > return err; > diff --git a/support/nfsidmap/regex.c b/support/nfsidmap/regex.c > index fdbb2e2..958b4ac 100644 > --- a/support/nfsidmap/regex.c > +++ b/support/nfsidmap/regex.c > @@ -157,6 +157,7 @@ again: > IDMAP_LOG(4, ("regexp_getpwnam: name '%s' mapped to '%s'", > name, localname)); > > + free(localname); > *err_p = 0; > return pw; > > -- > 2.27.0 > >