Skip to contentSkip to conversation

mount.nfs: mount's background daemon should free "mount_point" properly

PATCH In review Chuck Lever 3 participants 4 messages Aug 21, 2007 – Aug 24, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 mount.nfs: mount's background daemon should free "mount_point" properly

---

 utils/mount/mount.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
utils/mount/mount.c +2 -1
index d299358..40e7958 100644
@@ -557,7 +557,7 @@ int main(int argc, char *argv[])
 
 		/*
 		 * Parent exits immediately with success.  Make
-		 * sure not to free "mount_point"
+		 * sure parent doesn't free "mount_point".
 		 */
 		if (fork() > 0)
 			exit(0);
@@ -568,6 +568,7 @@ int main(int argc, char *argv[])
 		if (verbose && mnt_err)
 			printf(_("%s: giving up \"%s\"\n"),
 				progname, spec);
+		free(mount_point);
 		exit(0);
 	}
 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#1 lore raw

utils/mount/mount.c int main(int argc, char *argv[]) · line 560

Quoted 3 lines · Chuck Lever
utils/mount/mount.c +1 -1
 		 * Parent exits immediately with success.  Make
-		 * sure not to free "mount_point"
+		 * sure parent doesn't free "mount_point".

What made this change?

/* Steinar */

Signature · 10 lines
Homepage: http://www.sesse.net/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
NFS maillist  -  [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
#2 lore raw
Quoted 6 lines · Steinar H. Gunderson

utils/mount/mount.c int main(int argc, char *argv[]) · line 560

Quoted 3 lines · Chuck Lever
utils/mount/mount.c +1 -1
 		 * Parent exits immediately with success.  Make
-		 * sure not to free "mount_point"
+		 * sure parent doesn't free "mount_point".

What made this change?

Nothing, I'm clarifying my original comment here. I just didn't have time to test the additional free() before I submitted the first bg patches.

Before any of this was added, there was no free'ing of mount_point at all -- mount.nfs left exit() processing to free everything.

begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture: Linux Projects Group adr:;;1015 Granger Avenue;Ann Arbor;MI;48104;USA title:Principal Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
url:http://oss.oracle.com/~cel
version:2.1
end:vcard

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#3 lore raw
In reply to Chuck Lever
Quoted 11 lines · On Tuesday August 21, [email protected] wrote:

---

 utils/mount/mount.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
utils/mount/mount.c +0 -0
index d299358..40e7958 100644

utils/mount/mount.c int main(int argc, char *argv[]) · line 561

Quoted 6 lines
utils/mount/mount.c +1 -1
@@ -557,7 +557,7 @@ int main(int argc, char *argv[])
 
 		/*
 		 * Parent exits immediately with success.  Make
-		 * sure not to free "mount_point"
+		 * sure parent doesn't free "mount_point".
 		 */

I certainly agree that this comment could be improved. I don't think
your change improves it. I think I'll just remove the second sentence.

utils/mount/mount.c int main(int argc, char *argv[]) · line 574

Quoted 10 lines
utils/mount/mount.c +1 -0
 		if (fork() > 0)
 			exit(0);
@@ -568,6 +568,7 @@ int main(int argc, char *argv[])
 		if (verbose && mnt_err)
 			printf(_("%s: giving up \"%s\"\n"),
 				progname, spec);
+		free(mount_point);
 		exit(0);
 	}
 

Calling 'free' before 'exit' seems like an exercise in futility.. unless you want to remove warnings from 'valgrind' or something like that...
How about I just remove the 'exit(0)', and it will fall through and free(mount_point) and then exit (with a status that will be ignored)?

NeilBrown

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs