fixed memory leak + added header file to includes in cmake file