Skip to content

Instantly share code, notes, and snippets.

@mumumu
Created September 30, 2009 20:31
Show Gist options
  • Save mumumu/198414 to your computer and use it in GitHub Desktop.
Save mumumu/198414 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
static const int BUFSIZE = 256;
int main(int argc, char *argv[])
{
char *buffer = (char *)malloc(BUFSIZE);
if (buffer == NULL) {
fprintf(stderr, "out of memory");
return -1;
}
buffer++; // wrong.
free(buffer);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment