[rtems commit] libpci: Use calloc()

Sebastian Huber sebh at rtems.org
Fri Aug 25 10:54:26 UTC 2017


Module:    rtems
Branch:    master
Commit:    76b9c313ac0636ff0e1cb480325d084ecbed495d
Changeset: http://git.rtems.org/rtems/commit/?id=76b9c313ac0636ff0e1cb480325d084ecbed495d

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Aug 25 11:01:15 2017 +0200

libpci: Use calloc()

Update #2133.

---

 cpukit/libpci/pci_dev_create.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/cpukit/libpci/pci_dev_create.c b/cpukit/libpci/pci_dev_create.c
index 51c1536..4e84397 100644
--- a/cpukit/libpci/pci_dev_create.c
+++ b/cpukit/libpci/pci_dev_create.c
@@ -26,9 +26,8 @@ struct pci_dev *pci_dev_create(int isbus)
 	else
 		size = sizeof(struct pci_dev);
 
-	ptr = malloc(size);
+	ptr = calloc(1, size);
 	if (!ptr)
 		rtems_fatal_error_occurred(RTEMS_NO_MEMORY);
-	memset(ptr, 0, size);
 	return ptr;
 }



More information about the vc mailing list