Fix some yara warnings and memleaks