PERFORCE change 107770 for review

Todd Miller millert at FreeBSD.org
Thu Oct 12 12:27:58 PDT 2006


http://perforce.freebsd.org/chv.cgi?CH=107770

Change 107770 by millert at millert_macbook on 2006/10/12 19:27:35

	Remove extraneous mac_prepare() that was leaking memory;
	mac_from_text() does a prepare for us.

Affected files ...

.. //depot/projects/trustedbsd/sedarwin8/policies/sedarwin/libselinux/src/fsetfilecon.c#3 edit
.. //depot/projects/trustedbsd/sedarwin8/policies/sedarwin/libselinux/src/lsetfilecon.c#3 edit
.. //depot/projects/trustedbsd/sedarwin8/policies/sedarwin/libselinux/src/setcon.c#3 edit
.. //depot/projects/trustedbsd/sedarwin8/policies/sedarwin/libselinux/src/setfilecon.c#3 edit

Differences ...

==== //depot/projects/trustedbsd/sedarwin8/policies/sedarwin/libselinux/src/fsetfilecon.c#3 (text+ko) ====

@@ -13,15 +13,10 @@
         char  tmp[strlen(context) + strlen("sebsd/0")];
         int   r;
 
-        if (mac_prepare(&mac, "sebsd"))
-                return -1;
-
         strcpy(tmp, "sebsd/");
         strcat(tmp, context);
-        if (mac_from_text(&mac, tmp)) {
-                mac_free(mac);
+        if (mac_from_text(&mac, tmp))
                 return -1;
-        }
         r = mac_set_fd(fd, mac);
         mac_free(mac);
         return r;

==== //depot/projects/trustedbsd/sedarwin8/policies/sedarwin/libselinux/src/lsetfilecon.c#3 (text+ko) ====

@@ -12,15 +12,10 @@
         char  tmp[strlen(context) + strlen("sebsd/0")];
         int   r;
 
-        if (mac_prepare(&mac, "sebsd"))
-                return -1;
-
         strcpy(tmp, "sebsd/");
         strcat(tmp, context);
-        if (mac_from_text(&mac, tmp)) {
-                mac_free(mac);
+        if (mac_from_text(&mac, tmp))
                 return -1;
-        }
         r = mac_set_link(path, mac);
         mac_free(mac);
         return r;

==== //depot/projects/trustedbsd/sedarwin8/policies/sedarwin/libselinux/src/setcon.c#3 (text+ko) ====

@@ -15,14 +15,9 @@
 	mac_t label;
 	int error;
 	
-	error = mac_prepare(&label, "sebsd");
+	error = mac_from_text(&label, context);
 	if (error)
 		return -1;
-	error = mac_from_text(&label, context);
-	if (error) {
-		mac_free(label);
-		return -1;
-	}
 	error = mac_set_proc(label);
 	mac_free(label);
 	if (error)

==== //depot/projects/trustedbsd/sedarwin8/policies/sedarwin/libselinux/src/setfilecon.c#3 (text+ko) ====

@@ -12,15 +12,10 @@
         char  tmp[strlen(context) + strlen("sebsd/0")];
         int   ret;
 
-        if (mac_prepare(&mac, "sebsd"))
-                return -1;
-
         strcpy(tmp, "sebsd/");
         strcat(tmp, context);
-        if (mac_from_text(&mac, tmp)) {
-                mac_free(mac);
+        if (mac_from_text(&mac, tmp))
                 return -1;
-        }
         ret = mac_set_file(path, mac);
         mac_free(mac);
         return ret;


More information about the p4-projects mailing list