Skip to content

Instantly share code, notes, and snippets.

@kosaki
Created May 3, 2013 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kosaki/5514404 to your computer and use it in GitHub Desktop.
Save kosaki/5514404 to your computer and use it in GitHub Desktop.
#include <string.h>
#include <stdio.h>
void* xmalloc(size_t s);
int main(void)
{
char *str = "12345";
char *buf = xmalloc(5);
strcpy(buf, str);
return 0;
}
#include <stdlib.h>
void* xmalloc(size_t s)
{
return malloc(s);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment