anchao commented on code in PR #3023: URL: https://github.com/apache/nuttx-apps/pull/3023#discussion_r2012122191
########## system/nxplayer/nxplayer.c: ########## @@ -819,23 +818,11 @@ static FAR void *nxplayer_playthread(pthread_addr_t pvarg) /* Create array of pointers to buffers */ - buffers = (FAR struct ap_buffer_s **) - malloc(buf_info.nbuffers * sizeof(FAR void *)); - if (buffers == NULL) - { - /* Error allocating memory for buffer storage! */ - - ret = -ENOMEM; - running = false; - goto err_out; - } + FAR struct ap_buffer_s *buffers[buf_info.nbuffers]; /* Create our audio pipeline buffers to use for queueing up data */ - for (x = 0; x < buf_info.nbuffers; x++) - { - buffers[x] = NULL; - } + memset(buffers, 0, sizeof(FAR void *) * buf_info.nbuffers); Review Comment: Done ########## system/nxrecorder/nxrecorder.c: ########## @@ -551,23 +550,11 @@ static FAR void *nxrecorder_recordthread(pthread_addr_t pvarg) /* Create array of pointers to buffers */ - pbuffers = (FAR struct ap_buffer_s **) malloc(buf_info.nbuffers * - sizeof(FAR void *)); - if (pbuffers == NULL) - { - /* Error allocating memory for buffer storage! */ - - ret = -ENOMEM; - running = false; - goto err_out; - } + FAR struct ap_buffer_s *pbuffers[buf_info.nbuffers]; /* Create our audio pipeline buffers to use for queueing up data */ - for (x = 0; x < buf_info.nbuffers; x++) - { - pbuffers[x] = NULL; - } + memset(pbuffers, 0, sizeof(FAR void *) * buf_info.nbuffers); Review Comment: Done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org