public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Steve Dickson <steved@redhat.com>
To: Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: [PATCH] Revert "getnetconfig.c: free linep to avoid memory leakage"
Date: Wed, 13 Nov 2024 20:00:11 -0500	[thread overview]
Message-ID: <20241114010011.544247-1-steved@redhat.com> (raw)

This reverts commit f138e68e7ffefa3f4d71857ddb137fff877fd1d0.
---
 src/getnetconfig.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/getnetconfig.c b/src/getnetconfig.c
index 7888f8c..d547dce 100644
--- a/src/getnetconfig.c
+++ b/src/getnetconfig.c
@@ -503,7 +503,9 @@ getnetconfigent(netid)
 	    break;
 	}
     } while (stringp != NULL);
-    free(linep);
+    if (ncp == NULL) {
+	free(linep);
+    }
     fclose(file);
     return(ncp);
 }
-- 
2.47.0


             reply	other threads:[~2024-11-14  1:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-14  1:00 Steve Dickson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-11-14 15:59 [PATCH] Revert "getnetconfig.c: free linep to avoid memory leakage" Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241114010011.544247-1-steved@redhat.com \
    --to=steved@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox