if (f) fclose(f); if (p) free(p); p = NULL;
if (f) fclose(f);
if (p) free(p);
p = NULL;