Subject: bug#12444: Emacs, a segmentation fault occurs when saving a file on a NFS partition.

From: Eli Zaretskii <[email-masked]>
Date: Fri, 14 Sep 2012 20:03:39 +0300

> From: Yves Baumes <[email-masked]>
> Date: Fri, 14 Sep 2012 18:55:45 +0200
> Cc: [email-masked]
> 
> the bug occurred with emacs-24.2, fetch from the gnu's ftp. Do you mean it is fixed on the cvs repository?

In bzr, not in CVS.  Here's the patch committed by Andreas:

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2012-09-12 17:18:33 +0000
+++ src/ChangeLog	2012-09-14 16:35:25 +0000
@@ -1,3 +1,9 @@
+2012-09-14  Andreas Schwab  <[email-masked]>
+
+	* fileio.c (Ffile_selinux_context): Only call freecon when
+	lgetfilecon succeeded.
+	(Fset_file_selinux_context): Likewise.  (Bug#12444)
+
 2012-09-12  Eli Zaretskii  <[email-masked]>
 
 	* xdisp.c (try_window_reusing_current_matrix): Under bidi

=== modified file 'src/fileio.c'
--- src/fileio.c	2012-07-14 10:46:56 +0000
+++ src/fileio.c	2012-09-14 16:35:25 +0000
@@ -2841,9 +2841,8 @@ or if SELinux is disabled, or if Emacs l
 	  if (context_range_get (context))
 	    values[3] = build_string (context_range_get (context));
 	  context_free (context);
+	  freecon (con);
 	}
-      if (con)
-	freecon (con);
     }
 #endif
 
@@ -2920,12 +2919,10 @@ compiled with SELinux support.  */)
 	    report_file_error ("Doing lsetfilecon", Fcons (absname, Qnil));
 
 	  context_free (parsed_con);
+	  freecon (con);
 	}
       else
 	report_file_error ("Doing lgetfilecon", Fcons (absname, Qnil));
-
-      if (con)
-	freecon (con);
     }
 #endif