Fix mem leak found by asan

2 jobs for master in 15 minutes and 20 seconds (queued for 3 seconds)
Status Job ID Name Coverage
  Build
passed #53792
build_clazy_clang_tidy

00:15:19

passed #53791
linux kf5-qt5 qt5.12

00:10:55

0.0%