I'm using the realloc function in my program but it is not working properly.
Indeed, the call to realloc work 2 times out of 3 during the last call of realloc i get the following message: "* Error in `./sat': realloc(): invalid next size: 0x0000000000647520 * Aborted (core dumped)"
here is the part of my code that contains the call to realloc:
void insertInAssignedLitArray(int indiceVar, int indiceClause, int nbDeletedLiterrals, lit_t** delLit, clause_t* ptr, int signe, int nbClauseNonSat)
{
*delLit = (lit_t*)realloc(*delLit, nbDeletedLiterrals+1);
if (*delLit == NULL)
{
fprintf(stderr, "Erreur reallocation lors de la suppression du litteral\n");
exit(EXIT_FAILURE);
}
//some tasks.
}
I have already used some printfs and the values of nbDeletedLitterals are ok.
This function is called in another function, but i don't use delLit anywhere else.
Thanks in advance.