False positive "Bad pointer passed to global handle" in FreeLibrary() call.

 The below generates Bad pointer passed to global handle error.

 

HMODULE hModule;

hModule= LoadLibraryEx("Path//to//dll", NULL, LOAD_WITH_ALTERED_SEARCH_PATH);

FreeLibrary(hModule);// generated here.