Date: Fri, 7 Oct 2011 22:19:43 GMT From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 199877 for review Message-ID: <201110072219.p97MJhV7000216@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@199877?ac=10 Change 199877 by pjd@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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201110072219.p97MJhV7000216>