PERFORCE change 142603 for review

Vincenzo Iozzo snagg at FreeBSD.org
Fri May 30 21:38:09 UTC 2008


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

Change 142603 by snagg at snagg_macosx on 2008/05/30 21:37:44

	Fix a problem in the preselect_set

Affected files ...

.. //depot/projects/soc2008/snagg-audit/sys/security/audit/audit_pipe.c#20 edit

Differences ...

==== //depot/projects/soc2008/snagg-audit/sys/security/audit/audit_pipe.c#20 (text) ====

@@ -358,8 +358,9 @@
 	 */
 	KASSERT(num >= 0, ("Number of events is out of range"));    
 	app_new = malloc(sizeof(*app_new), M_AUDIT_PIPE_PRESELECT, M_WAITOK);
-	app_new->app_auevents= malloc(sizeof(struct audit_pipe_preselect_event) *
-	    num, M_AUDIT_PIPE_PRESELECT_EVENT, M_WAITOK);
+	if(num)
+		app_new->app_auevents= malloc(sizeof(struct audit_pipe_preselect_event) *
+	    	num, M_AUDIT_PIPE_PRESELECT_EVENT, M_WAITOK);
 		
 	mtx_lock(&audit_pipe_mtx);
 	
@@ -398,7 +399,8 @@
 	mtx_unlock(&audit_pipe_mtx);
 	if (app_new != NULL) {
 		free(app_new, M_AUDIT_PIPE_PRESELECT);
-		free(app_new->app_auevents, M_AUDIT_PIPE_PRESELECT_EVENT);
+		if(num)
+			free(app_new->app_auevents, M_AUDIT_PIPE_PRESELECT_EVENT);
 	}	
 }
 


More information about the p4-projects mailing list