Hi.


All examples I have seen that use recv (in C wich is what I use) has had the buffer (that is filled up with recv) declared as:

char buffer[256];

I have done the following:

char *buffer=NULL;
buffer=malloc((BUFFSIZE)*sizeof(char));

and it all seem to work fine until the end of my function where I try to free the allocated memory with:

free(buffer);

Then the program buggs out on me.
Since I´m running MS VC++ I´ve done some debugging on it but haven´t found out why this is happeninig. buffer is allocated and contains info when trying to do the free().

So I wonder if it might be so that recv messes up my allocated buffer since I did get it thru malloc?

Or do anyone have another point of view?