Fix coverity issues (#19422)
Cleanup during shutdown if needed (address coverity warning)
Stelios Fragkakis committed
Jan 17, 2025 at 13:22 UTC
55590471706c8cd6e046b3b115aae018e9287584
1 file changed
+34
src/database/sqlite/sqlite_metadata.c
+34
@@ -2606,6 +2606,40 @@ static void metadata_event_loop(void *arg)
2606
completion_destroy(wc->scan_complete);
2607
freez(wc->scan_complete);
2608
}
2609
+
2610
+ Word_t Index;
2611
+ bool first;
2612
+
2613
+ if (cl_cleanup_data) {
2614
+ Index = 0;
2615
+ first = true;
2616
+ while ((PValue = JudyLFirstThenNext(cl_cleanup_data->JudyL, &Index, &first))) {
2617
+ char *machine_guid = *PValue;
2618
+ freez(machine_guid);
2619
+ }
2620
+ JudyLFreeArray(&cl_cleanup_data->JudyL, PJE0);
2621
+ freez(cl_cleanup_data);
2622
+ }
2623
+
2624
+ if (pending_ae_list) {
2625
+ (void)JudyLFreeArray(&pending_ae_list->JudyL, PJE0);
2626
+ freez(pending_ae_list);
2627
+ }
2628
+
2629
+ if (pending_ctx_cleanup_list) {
2630
+ Index = 0;
2631
+ first = true;
2632
+ while ((PValue = JudyLFirstThenNext(pending_ctx_cleanup_list->JudyL, &Index, &first))) {
2633
+ if (!*PValue)
2634
+ continue;
2635
+ struct host_ctx_cleanup_s *ctx_cleanup = *PValue;
2636
+ string_freez(ctx_cleanup->context);
2637
+ freez(ctx_cleanup);
2638
+ }
2639
+ (void)JudyLFreeArray(&pending_ctx_cleanup_list->JudyL, PJE0);
2640
+ freez(pending_ctx_cleanup_list);
2641
+ }
2642
+
2643
metadata_free_cmd_queue(wc);
2644
return;
2645