anchao opened a new pull request, #20863:
URL: https://github.com/apache/nuttx/pull/20863

   ## Summary                                                             
                                                                          
   Fix a block driver reference leak in `bchlib_setup()`.                 
                                                                          
   `bchlib_setup()` opens the backing block driver first, then queries the
   device geometry and validates write support. If one of those post-open 
   validation steps failed, the previous error path freed the BCH state   
   structure but did not close the opened block driver.                   
                                                                          
   This change routes those post-open failures through a cleanup path that
   calls `close_blockdriver()` before freeing the BCH state structure.    
                                                                          
   ## Impact                                                              
                                                                          
   - Prevents leaking the opened block driver when BCH setup validation   
     fails.                                                               
   - Keeps the successful setup path unchanged.                           
   - Only affects error paths after `open_blockdriver()` succeeds.        
                                                                          
   ## Testing                                                             
   
   sim/nxscope


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to