Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Nov 2018 13:29:56 +0000 (UTC)
From:      Toomas Soome <tsoome@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r339993 - head/stand/libsa
Message-ID:  <201811011329.wA1DTu7T051949@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tsoome
Date: Thu Nov  1 13:29:55 2018
New Revision: 339993
URL: https://svnweb.freebsd.org/changeset/base/339993

Log:
  libsa: tftp should use calloc
  
  instead of malloc() memset(), use calloc().

Modified:
  head/stand/libsa/tftp.c

Modified: head/stand/libsa/tftp.c
==============================================================================
--- head/stand/libsa/tftp.c	Thu Nov  1 13:12:05 2018	(r339992)
+++ head/stand/libsa/tftp.c	Thu Nov  1 13:29:55 2018	(r339993)
@@ -448,11 +448,10 @@ tftp_open(const char *path, struct open_file *f)
 	if (is_open)
 		return (EBUSY);
 
-	tftpfile = (struct tftp_handle *) malloc(sizeof(*tftpfile));
+	tftpfile = calloc(1, sizeof(*tftpfile));
 	if (!tftpfile)
 		return (ENOMEM);
 
-	memset(tftpfile, 0, sizeof(*tftpfile));
 	tftpfile->tftp_blksize = TFTP_REQUESTED_BLKSIZE;
 	tftpfile->iodesc = io = socktodesc(*(int *) (f->f_devdata));
 	if (io == NULL) {



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