Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#include <string.h>
#include <stdio.h>
void* xmalloc(size_t s) __attribute__ ((alloc_size(1)));
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
You can’t perform that action at this time.