I've been doing some tests with this code:
int main()
{
int i;
float *a, *b;
a=(float*)malloc(sizeof(float)*10);
b=(float*)malloc(sizeof(float)*20);
b = a; //FUGA DE MEMORIA???
free(a); free(b);
}
My question is, as it appears in the comment, will there be a memory leak when assigning the value from "a" to "b", that is, I will not be able to release those 20 "floats" that I reserved for "b"? "?
And that line with two calls to free (), is one of them superfluous (or even dangerous)?