SONAR-5718 Fix memory leak