[rtems commit] libdl: Fix allocator NULL check (Coverity 1255328) refs #2191

Chris Johns chrisj at rtems.org
Wed Nov 19 21:31:30 UTC 2014


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

Author:    Chris Johns <chrisj at rtems.org>
Date:      Thu Nov 20 08:30:01 2014 +1100

libdl: Fix allocator NULL check (Coverity 1255328) refs #2191

The address returned from the allocator call was not checked when zeroing
the memory.

---

 cpukit/libdl/rtl-allocator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpukit/libdl/rtl-allocator.c b/cpukit/libdl/rtl-allocator.c
index b845013..26044c2 100644
--- a/cpukit/libdl/rtl-allocator.c
+++ b/cpukit/libdl/rtl-allocator.c
@@ -61,7 +61,7 @@ rtems_rtl_alloc_new (rtems_rtl_alloc_tag_t tag, size_t size, bool zero)
     printf ("rtl: alloc: new: %s addr=%p size=%zu\n",
             rtems_rtl_trace_tag_label (tag), address, size);
 
-  if (zero)
+  if (address && zero)
     memset (address, 0, size);
 
   return address;



More information about the vc mailing list