]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
test/rgw/posix: free the quota handler in TestDriver 69285/head
authorKefu Chai <k.chai@proxmox.com>
Thu, 4 Jun 2026 10:38:24 +0000 (18:38 +0800)
committerKefu Chai <k.chai@proxmox.com>
Thu, 4 Jun 2026 10:44:03 +0000 (18:44 +0800)
commit3e5008640bd0c433f5c6983d9c2c5889b1b1a710
treeebb4a8c4794efadb215e3aa87cd2de16e725639b
parent1866a945dc0e0c9ea6dd4004cf4f2ca8b55ad069
test/rgw/posix: free the quota handler in TestDriver

TestDriver::init() allocates quota_handler via
RGWQuotaHandler::generate_handler() but nothing frees it. The real
POSIXDriver frees it in finalize(), which the unit tests never call, so
every fixture that runs init() leaks the handler and the stat caches
hanging off it: 274 allocations, ~40KB, all rooted at generate_handler()
under ASan:

  ==6102==ERROR: LeakSanitizer: detected memory leaks
  Direct leak of 3200 byte(s) in 5 object(s) allocated from:
    #1 RGWQuotaHandler::generate_handler(...) src/rgw/rgw_quota.cc:989
    #2 TestDriver::init(...) src/test/rgw/test_rgw_posix_driver.cc:1100
    #3 POSIXDriverTest::SetUp() src/test/rgw/test_rgw_posix_driver.cc:1191
    ...
  SUMMARY: AddressSanitizer: 40099 byte(s) leaked in 274 allocation(s).

So free it in ~TestDriver(), the counterpart to the init() allocation.
~POSIXDriver() is empty and nothing else touches quota_handler, so there
is no double free, and free_handler(nullptr) is a no-op when init()
bailed out early.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
src/test/rgw/test_rgw_posix_driver.cc