Date: Thu, 12 Oct 2006 19:27:55 GMT From: Todd Miller <millert@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 107770 for review Message-ID: <200610121927.k9CJRt5U063781@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=107770 Change 107770 by millert@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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610121927.k9CJRt5U063781>