pFileSearch->lpPattern and pFileSearch->lpPath must also be freed (here and and in the other error handlers above).
Easier to always call FindClose() on error but FindClose needs to be fixed first to check ->pDir before calling closedir()