You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2022/07/23 19:58:23 UTC

[incubator-nuttx-apps] 20/20: app/system/uorb: fix error, memset() wrong size.

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 74af9a8065c68d66bfdf0590aa8f96a819e402fc
Author: jihandong <ji...@xiaomi.com>
AuthorDate: Mon May 9 17:28:47 2022 +0800

    app/system/uorb: fix error, memset() wrong size.
    
    Signed-off-by: jihandong <ji...@xiaomi.com>
---
 system/uorb/listener.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/system/uorb/listener.c b/system/uorb/listener.c
index 237e149d8..71f833a17 100644
--- a/system/uorb/listener.c
+++ b/system/uorb/listener.c
@@ -509,7 +509,7 @@ static void listener_monitor(FAR struct list_node *objlist, int nb_objects,
       return;
     }
 
-  recv_msgs = malloc(nb_objects * sizeof(int));
+  recv_msgs = calloc(nb_objects, sizeof(int));
   if (!recv_msgs)
     {
       free(fds);
@@ -560,8 +560,6 @@ static void listener_monitor(FAR struct list_node *objlist, int nb_objects,
       return;
     }
 
-  memset(recv_msgs, 0, sizeof(recv_msgs));
-
   /* Loop poll and print recieved messages */
 
   while ((!nb_msgs || nb_recv_msgs < nb_msgs) && !g_should_exit)