I am facing a memory leak condition in the following functions. 

```
char * readdatafromfile(unsigned pageNumber) {
    char *buff = (char*) malloc(sizeof(char) * pagesize);
    lseek(fd, pagesize * (pageNumber), SEEK_SET);
    read(fd, buff, pagesize);

    return buff;
}
//Read from file
char * readfromfile(char *fname, int pageno) {
    char *buff = NULL;
    fd = searchinvector(fname);
    if (fd > 0)
        buff = readdatafromfile(pageno);
    else
        printf("\nINDEX is not opened\n");
    return buff;
}

```

I am trying to call the function the following way

```
char* root_buf = readfromfile(fname,pageno);

```

Can someone point to me where the memory leak occurs and how to overcome it.

***EDIT***

I do call free(root\_buf); later. Forgot to mention that part. I believe this has to do with the fact that I am creating a pointer and returning it. Maybe the reference is caught in another pointer in the caller function.