PERFORCE change 90106 for review

Robert Watson rwatson at FreeBSD.org
Sat Jan 21 08:31:08 PST 2006


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

Change 90106 by rwatson at rwatson_sesame on 2006/01/21 16:30:41

	Always clear 'dptr' if the allocation of t fails in
	GET_TOKEN_AREA() to prevent accidents.

Affected files ...

.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#31 edit

Differences ...

==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#31 (text+ko) ====

@@ -58,17 +58,17 @@
 #include <bsm/libbsm.h>
 
 #define	GET_TOKEN_AREA(t, dptr, length) do {				\
-	t = malloc (sizeof(token_t));					\
+	t = malloc(sizeof(token_t));					\
 	if (t != NULL) {						\
 		t->len = (length);					\
-		t->t_data = malloc ((length) * sizeof(u_char));		\
-		if ((dptr = t->t_data) == NULL) {			\
+		dptr = t->t_data = malloc ((length) * sizeof(u_char));	\
+		if (dptr == NULL) {					\
 			free(t);					\
 			t = NULL;					\
 		} else							\
 			memset(dptr, 0, (length));			\
-	}								\
-	assert(t == NULL || dptr != NULL);				\
+	} else								\
+		dptr = NULL;						\
 } while (0)
 
 /*


More information about the p4-projects mailing list