RTEMS | cpukit/libblock: Fixes off-by-1 and memory in flashdisk (!912)

Gedare Bloom (@gedare) gitlab at rtems.org
Wed Feb 4 15:06:09 UTC 2026




Gedare Bloom started a new discussion on cpukit/libblock/src/flashdisk.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/912#note_141072

 >      if (ret)
 >      {
 >        unlink (name);
 > -      rtems_mutex_destroy (&fd->lock);
 > -      free (fd->copy_buffer);
 > -      free (fd->blocks);
 > -      free (fd->devices);
 > +      mutex_initialized = true;
 > +      rtems_fdisk_cleanup(base_fd, minor, &mutex_initialized);
 > +      free (base_fd);

it seems like every time you call `rtems_fdisk_cleanup` you also `free(base_fd)`. Could that also be done in the cleanup function?

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/912#note_141072
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/20260204/f4595d08/attachment-0001.htm>


More information about the bugs mailing list