SONARJAVA-813 Fix memory leak