I get a double free or corruption error message on my server.c, although I am not freeing any thing in my functions. I also tested my functions and they are all working properly supposedly. Can any one Check my code and Tell me if something is wrong ?
parse function
bool parse(const char* line, char* abs_path, char* query)
{
// my function set a pointer to the beginning of the
// request target the counts the characters of the full
// request target and the characters of the absolute path only
// than copies the required strings according to the counted
// characters
if (n_que != 0)
{
strncpy(abs_path, req_tar, n_que - 2);
strncpy(query, q_cur, (n_abs - n_que) + 1);
}
else
{
strncpy(abs_path, req_tar, n_abs);
query[0] = '\0';
}
return true;
}
load function
bool load(FILE* file, BYTE** content, size_t* length)
{
// checks for a null file pointer
if(file == NULL)
{
return false;
}
int n_bytes = 0;
BYTE in_bytes = 0;
BYTE* ptr_bytes;
// stores the current byte in a temp memory
// reads the file byte by byte and stores every new byte in
// temp memory in_bytes than reallocates the ptr_bytes to a larger
// memory
}
EDITED