RTEMS | aio_fsync.c: Use calloc() to ensure memory is initialized (!172)
Sebastian Huber (@sebhub)
gitlab at rtems.org
Wed Aug 14 03:22:39 UTC 2024
Sebastian Huber started a new discussion on cpukit/posix/src/aio_fsync.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/172#note_110946
> )
> rtems_set_errno_and_return_minus_one( EBADF );
>
> - req = malloc( sizeof( rtems_aio_request ) );
> + req = (rtems_aio_request *) calloc( 1, sizeof( rtems_aio_request ) );
Maybe use `calloc( 1, sizeof( *req ) )` since is more robust against type changes of `req`.
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/172#note_110946
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20240814/9d4cec3e/attachment.htm>
More information about the bugs
mailing list