MITHILESH MATTAPALLI commented on a discussion on cpukit/libblock/src/nvdisk.c: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/905#note_139733

 >      nvd->info_level   = c->info_level;
 >  
 >      nvd->devices = calloc (c->device_count, sizeof 
 > (rtems_nvdisk_device_ctl));
 > -    if (!nvd->devices)
 > +    if (!nvd->devices) {
 > +      if (i > 0) {
 > +        rtems_nvdisk* p = nvd_start;
 > +        for (j = 0; j < i; ++j, ++p) {
 > +          free (p->devices);
 > +        }
 > +      }
 > +      free (nvd_start);

Fixed. I have refactored this to use a centralized goto error_cleanup block to 
remove the code duplication and ensure safe teardown (unlinking, mutex 
destruction) in all error paths, matching the approach used in the Flashdisk 
patch.

-- 
View it on GitLab: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/905#note_139733
You're receiving this email because of your account on gitlab.rtems.org.


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to