PERFORCE change 167050 for review

Robert Watson rwatson at FreeBSD.org
Wed Aug 5 19:56:31 UTC 2009


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

Change 167050 by rwatson at rwatson_cinnamon on 2009/08/05 19:55:43

	Fix warnings.

Affected files ...

.. //depot/projects/soc2009/marinosi_appaudit/src/sys/security/audit/audit_slice.c#7 edit

Differences ...

==== //depot/projects/soc2009/marinosi_appaudit/src/sys/security/audit/audit_slice.c#7 (text+ko) ====

@@ -171,7 +171,7 @@
 	int nbytes = 0; /*Remaining bytes */
 	struct bsm_rec_hdr *audit_slice_dev_buf;
 	struct audit_slice *as;
-	void *as_rec;
+	void *as_rec = NULL;
 
 	as = dev->si_drv1;
 
@@ -204,7 +204,7 @@
 		 * longer than MAX_AUDIT_RECORD_SIZE, or less than
 		 * sizeof(*audit_slice_dev_buf).
 		 */
-		recsz = be32dec (audit_slice_dev_buf->rec_byte_count);
+		recsz = be32toh(audit_slice_dev_buf->rec_byte_count);
 		as_rec = (void *)malloc((unsigned long)recsz, M_AUDITBSM, 
 				M_WAITOK | M_ZERO);
 
@@ -224,7 +224,8 @@
 	 * XXXRW: Only free as_rec if we allocated it.
 	 */
 	free(audit_slice_dev_buf, M_TEMP);
-	free(as_rec, M_AUDITBSM);
+	if (as_rec != NULL)
+		free(as_rec, M_AUDITBSM);
 
 	return (error);
 }


More information about the p4-projects mailing list