[PATCH v1 2/4] main_rtrace.c: Add error return when malloc fails

Ryan Long ryan.long at oarcorp.com
Fri May 28 19:11:23 UTC 2021


CID 1399709: Dereference after null check in
rtems_trace_buffering_shell_save().

Closes #4329
---
 cpukit/libmisc/shell/main_rtrace.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/cpukit/libmisc/shell/main_rtrace.c b/cpukit/libmisc/shell/main_rtrace.c
index 753ab9d..e4f59c4 100644
--- a/cpukit/libmisc/shell/main_rtrace.c
+++ b/cpukit/libmisc/shell/main_rtrace.c
@@ -473,6 +473,7 @@ rtems_trace_buffering_shell_save (int argc, char *argv[])
   {
     close (out);
     printf ("error: no memory\n");
+    return 1;
   }
 
   memset (buf, 0, SAVE_BUF_SIZE);
-- 
1.8.3.1



More information about the devel mailing list