Fixes cmake missing code path. Fixes not free memory. Fixes incorrect log message