R
raghu
Hello Every one,
I am writing a program in gcc compiler which contains many
functions. In main I created memory for a variable and tried to free
in another function. But I am getting error as segmentation fault at
some times or glibc free Invalid Pointer at some times. Can any one of
you help me out. But I must free the data.
A(){
mem= (char *)malloc(sizeof(char));
mem = B(mem);
}
B(char *K)
{
char *j;
memcpy(j, K, length);
....
free(K);
return j;
}
This one will give you an idea.
Thanking you all
Bye
Raghu
I am writing a program in gcc compiler which contains many
functions. In main I created memory for a variable and tried to free
in another function. But I am getting error as segmentation fault at
some times or glibc free Invalid Pointer at some times. Can any one of
you help me out. But I must free the data.
A(){
mem= (char *)malloc(sizeof(char));
mem = B(mem);
}
B(char *K)
{
char *j;
memcpy(j, K, length);
....
free(K);
return j;
}
This one will give you an idea.
Thanking you all
Bye
Raghu