When I run my code through Analysis, I get that there is a potential memory leak pointed to by path.
I don't see it. Anybody?
I don't see it. Anybody?
Code:
get_index_and_open(FILE * listp)
{
char *filename, *path;
filename = (char *)calloc(75, sizeof(char));
path = (char *)calloc(75, sizeof(char));
if ((fscanf(listp, "%s", filename)) != 1) {
return (NULL);
} else {
strcpy(path, home);
strcat(path, filename);
if ((datap = fopen(path, "r")) == NULL) {
printf("Couldn't open index file\n");
} else {
printf("opened data file %s\n", filename);
fscanf(datap, "%s", filename);
}
}
free(filename);
free(path);
return (datap);
}
/[code]