RTEMS | flashdisk.c: Fixed garbage name generation and added memory cleanup (!912)
Gedare Bloom (@gedare)
gitlab at rtems.org
Thu Jan 22 17:30:51 UTC 2026
Gedare Bloom commented on a discussion on cpukit/libblock/src/flashdisk.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/912#note_139518
> + return;
> +
> + uint32_t device;
> +
> + if(fd->devices)
> + {
> + for(device = 0; device< fd->device_count; device++)
> + {
> + free(fd->devices[device].segments);
> + fd->devices[device].segments = NULL;
> + }
> + }
> + free(fd->devices);
> + fd->devices = NULL;
> +
> + free(fd->blocks);
Please don't resolve the threads yourself, leave them open for the reviewer to resolve.
You don't need to check for NULL, but you do have to be certain that everything is initialized to NULL **before** calling `calloc`, because this function gets called without completing the `rtems_fdisk_initialize`. Since the `fd` is created with `calloc` then this should be the case, so it's fine.
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/912#note_139518
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/20260122/bd4923bf/attachment-0001.htm>
More information about the bugs
mailing list