From owner-trustedbsd-cvs@FreeBSD.ORG Thu Oct 12 19:28:11 2006 Return-Path: X-Original-To: trustedbsd-cvs@freebsd.org Delivered-To: trustedbsd-cvs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DB04C16A519 for ; Thu, 12 Oct 2006 19:28:10 +0000 (UTC) (envelope-from owner-perforce@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0458643D64 for ; Thu, 12 Oct 2006 19:27:59 +0000 (GMT) (envelope-from owner-perforce@freebsd.org) Received: from mx2.freebsd.org (mx2.freebsd.org [216.136.204.119]) by cyrus.watson.org (Postfix) with ESMTP id 4D52546D5F for ; Thu, 12 Oct 2006 15:27:59 -0400 (EDT) Received: from hub.freebsd.org (hub.freebsd.org [216.136.204.18]) by mx2.freebsd.org (Postfix) with ESMTP id 11FB555F5E; Thu, 12 Oct 2006 19:27:58 +0000 (GMT) (envelope-from owner-perforce@freebsd.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id 092B916A40F; Thu, 12 Oct 2006 19:27:58 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D908016A403 for ; Thu, 12 Oct 2006 19:27:57 +0000 (UTC) (envelope-from millert@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8FE9B43D64 for ; Thu, 12 Oct 2006 19:27:55 +0000 (GMT) (envelope-from millert@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k9CJRtaG063784 for ; Thu, 12 Oct 2006 19:27:55 GMT (envelope-from millert@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k9CJRt5U063781 for perforce@freebsd.org; Thu, 12 Oct 2006 19:27:55 GMT (envelope-from millert@freebsd.org) Date: Thu, 12 Oct 2006 19:27:55 GMT Message-Id: <200610121927.k9CJRt5U063781@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to millert@freebsd.org using -f From: Todd Miller To: Perforce Change Reviews Cc: Subject: PERFORCE change 107770 for review X-BeenThere: trustedbsd-cvs@FreeBSD.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: TrustedBSD CVS and Perforce commit message list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Oct 2006 19:28:11 -0000 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;