Skip to content

Instantly share code, notes, and snippets.

@sl4v
Created June 22, 2022 18:08
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 sl4v/e1d19834bca31ae6e8d94ce6fa3cc324 to your computer and use it in GitHub Desktop.
Save sl4v/e1d19834bca31ae6e8d94ce6fa3cc324 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
puts("Basic allocation example.\n");
char* a = malloc(0x10);
strcpy(a, "AAAAAAAAAAAAAAA"); // A * 15
char* b = malloc(0x12);
memcpy(b, "BBBBBBBBBBBBBBBBBBBBBBBB", 24); // B * 23
char* c = malloc(496); // was 0x200
char* c = malloc(496); // was 0x200
char* d = malloc(0x500);
char* e = malloc(0x500);
char* f = malloc(0x500);
char* g = malloc(0x500);
char* h = malloc(0x500);
free(a);
free(b);
free(c);
free(d);
// free(e);
free(f);
free(h);
free(g);
puts("End.\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment