Fix mem leak found by asan

2 jobs for master in 8 minutes and 8 seconds (queued for 6 minutes and 43 seconds)
Status Job ID Name Coverage
  Build
passed #53092
build_clazy_clang_tidy

00:05:26

passed #53091
linux kf5-qt5 qt5.12

00:02:42

80.0%