Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Jan 2006 16:31:06 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 90106 for review
Message-ID:  <200601211631.k0LGV6Mh090614@repoman.freebsd.org>

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

Change 90106 by rwatson@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)
 
 /*



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