I have a question about the dispatch method C.
int send (int socket, void *buffer, size_t size, int flags);
My code is:
char *buffer = (char *)malloc(100*sizeof(char)); send(s, buffer, 100*sizeof(char), MSG_NOSIGNAL);
Now I was wondering if I should free the buffer myself or send the send method?
My code where I free the buffer is:
char *buffer = (char *)malloc(100*sizeof(char)); send(s, buffer, 100*sizeof(char), MSG_NOSIGNAL); free(buffer);
When I saw the error, I thought that I soon freed the buffer, and the send method still used memory.
Tell me.
source share