diff options
author | sinanmohd <sinan@firemail.cc> | 2023-05-20 20:23:20 +0530 |
---|---|---|
committer | sinanmohd <sinan@firemail.cc> | 2023-05-20 20:54:26 +0530 |
commit | 746ea2a4ed3d395a7460ce627c64a2e1a222bc7e (patch) | |
tree | 89452795548f60bff15538a92bd92b6dd8d663ae /8.8/main.c | |
parent | 1e05635a00b545f163bc7aaeaf8aa1d37c63943d (diff) |
8.8: initial commit
Diffstat (limited to '8.8/main.c')
-rw-r--r-- | 8.8/main.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/8.8/main.c b/8.8/main.c new file mode 100644 index 0000000..f4ef71e --- /dev/null +++ b/8.8/main.c @@ -0,0 +1,24 @@ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include "malloc.h" + +int main(void) +{ + char *s; + + /* size of header is 16 bytes so the mem space should + * be atleast 16 * 2 = 32 bytes to call bfree */ + s = malloc(32); + bfree(s, 32); + s = my_malloc(11); + + strcpy(s, "just werks"); + printf("%s\n", s); + + /* ||-16:HEADER-||||-16:FREE-|| */ + my_free(s); + free(s - 16); + + return 0; +} |