I have the following structures:
typedef struct Node
{
char info[40];
struct Node *ant;
struct Node *prox;
}NoCDup;
typedef struct LDEC
{
NoCDup *cabeca;
NoCDup *cauda;
int tamanho;
}ListaCDup;
And also the function that initializes the double-linked and circular list:
ListaCDup *criar()
{
ListaCDup *p = (ListaCDup*) malloc (sizeof(ListaCDup));
p->cabeca = p->cauda = NULL;
p->tamanho = 0;
return p;
}
And in main simply:
int main(){
ListaCDup *l = criar();
ImprimeListaCDup(l);
return 0;
}
But when I check for memory errors with valgrind, I have the following problem:
==10879== in use at exit: 12 bytes in 1 blocks
==10879== total heap usage: 1 allocs, 0 frees, 12 bytes allocated
==10879==
==10879== 12 bytes in 1 blocks are definitely lost in loss record 1 of 1
==10879== at 0x482E27C: malloc (vg_replace_malloc.c:299)
==10879== by 0x10869E: criar (in /home/student/Downloads/lista)
==10879== by 0x108D3B: main (in /home/student/Downloads/lista)
Does anyone know why?