PERFORCE change 199877 for review

Pawel Jakub Dawidek pjd at FreeBSD.org
Fri Oct 7 22:19:44 UTC 2011


http://p4web.freebsd.org/@@199877?ac=10

Change 199877 by pjd at pjd_anger on 2011/10/07 22:19:14

	Prefer calloc() over malloc()+memset(ptr, 0, size).

Affected files ...

.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_io.c#69 edit

Differences ...

==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_io.c#69 (text+ko) ====

@@ -32,7 +32,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_io.c#68 $
+ * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_io.c#69 $
  */
 
 #include <sys/types.h>
@@ -4485,11 +4485,10 @@
 			return (-1);
 		}
 
-		*buf = malloc(recsize * sizeof(u_char));
+		*buf = calloc(recsize, sizeof(u_char));
 		if (*buf == NULL)
 			return (-1);
 		bptr = *buf;
-		memset(bptr, 0, recsize);
 
 		/* store the token contents already read, back to the buffer*/
 		*bptr = type;


More information about the p4-projects mailing list