Improved query target cleanup (#17038)
Clear smh to avoid possible double metric release
Stelios Fragkakis committed
Feb 20, 2024 at 20:48 UTC
e1eca0562faa4a7818607656cc72aec4d2c35612
1 file changed
+3
-1
src/database/contexts/query_target.c
+3
-1
@@ -346,8 +346,10 @@ static bool query_metric_add(QUERY_TARGET_LOCALS *qtl, QUERY_NODE *qn, QUERY_CON
346
347
// cleanup anything we allocated to the retention we will not use
348
for(size_t tier = 0; tier < storage_tiers ;tier++) {
349
- if (tier_retention[tier].smh)
349
+ if (tier_retention[tier].smh) {
350
tier_retention[tier].eng->api.metric_release(tier_retention[tier].smh);
351
+ tier_retention[tier].smh = NULL;
352
+ }
353
}
354
355
return false;