Fix mem leak found by ASAN

2 jobs for master in 67 minutes and 46 seconds (queued for 3 minutes and 12 seconds)
Status Job ID Name Coverage
  Build
passed #53544
build_clazy_clang_tidy

00:45:20

passed #53543
linux kf5-qt5 qt5.12

00:22:25

26.0%