]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
rgw: refactor D3nDataCache::d3n_io_write to avoid resource leaks 51648/head
authorVedansh Bhartia <vedanshbhartia@gmail.com>
Sun, 16 Jul 2023 15:49:17 +0000 (21:19 +0530)
committerVedansh Bhartia <vedanshbhartia@gmail.com>
Sun, 16 Jul 2023 15:49:17 +0000 (21:19 +0530)
commitb0e6fc0ddae500f6f18d9119e5ed7b2be48bce79
tree6adc803a2a1695cc162a082bd7b5aea094d66133
parent652434f8f7ba39cbfc5a01fb299da5b09ad29e16
rgw: refactor D3nDataCache::d3n_io_write to avoid resource leaks
1. D3nChunkDataInfo was allocated at the beginning of the function on
   the heap, and was not freed in case of errors. This memory allocation
   has been moved to where it is being utilised.
2. cache_file file descriptor was not closed if the write to the file
   failed. To avoid such issues, cache_file is declared as a unique_ptr
   with a custom deleter that closes the descriptor when the ptr goes
   out of scope.

Signed-off-by: Vedansh Bhartia <vedanshbhartia@gmail.com>
src/rgw/driver/rados/rgw_d3n_datacache.cc