Fix mem leak found by asan

2 jobs for master in 7 minutes and 35 seconds (queued for 10 minutes and 20 seconds)
Status Name Job ID Coverage
  Build
passed build_clazy_clang_tidy #103101

00:05:10

passed linux kf5-qt5 qt5.15 #103100

00:02:25

35.0%