[rtems commit] libblock: Fix ramdisk::free_at_delete_request init

Sebastian Huber sebh at rtems.org
Fri Jan 15 13:21:00 UTC 2016


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Jan 15 14:11:03 2016 +0100

libblock: Fix ramdisk::free_at_delete_request init

Avoid uninitialized ramdisk::free_at_delete_request.  The error was
visible in sporadic libtests/block01 failures.

---

 cpukit/libblock/src/ramdisk-init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpukit/libblock/src/ramdisk-init.c b/cpukit/libblock/src/ramdisk-init.c
index 45b1329..cc2ad3e 100644
--- a/cpukit/libblock/src/ramdisk-init.c
+++ b/cpukit/libblock/src/ramdisk-init.c
@@ -36,7 +36,7 @@ ramdisk *ramdisk_allocate(
   bool trace
 )
 {
-  struct ramdisk *rd = malloc(sizeof(struct ramdisk));
+  struct ramdisk *rd = calloc(1, sizeof(*rd));
 
   if (rd == NULL) {
     return NULL;




More information about the vc mailing list