Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Apr 2005 11:02:27 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 75313 for review
Message-ID:  <200504161102.j3GB2RH6057390@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=75313

Change 75313 by rwatson@rwatson_paprika on 2005/04/16 11:01:50

	Only allocate storage for a new rule if we're not deleting an existing
	rule.

Affected files ...

.. //depot/projects/trustedbsd/mac/sys/security/mac_bsdextended/mac_bsdextended.c#89 edit

Differences ...

==== //depot/projects/trustedbsd/mac/sys/security/mac_bsdextended/mac_bsdextended.c#89 (text+ko) ====

@@ -154,7 +154,7 @@
 		return (ENOENT);
 
 	ruleptr = NULL;
-	if (req->newptr) {
+	if (req->newptr && req->newlen != 0) {
 		error = SYSCTL_IN(req, &temprule, sizeof(temprule));
 		if (error)
 			return (error);
@@ -178,7 +178,7 @@
 
 	if (req->newptr && req->newlen == 0) {
 		/* printf("deletion\n"); */
-		FREE(ruleptr, M_MACBSDEXTENDED);
+		KASSERT(ruleptr == NULL, ("sysctl_rule: ruleptr != NULL"));
 		ruleptr = rules[index];
 		if (ruleptr == NULL) {
 			error = ENOENT;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200504161102.j3GB2RH6057390>