Created
November 7, 2014 16:06
-
-
Save mopp/43091cd7d4a1213310b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
char* global_strs = NULL; | |
void do_free(void) { | |
if (global_strs != NULL) { | |
free(global_strs); | |
puts("freed."); | |
} else { | |
puts("global_strs is already freed."); | |
} | |
} | |
int main(int argc, char const* argv[]) { | |
global_strs = malloc(1000 * sizeof(char)); | |
memset(global_strs, 0x1b, 1000 * sizeof(char)); | |
puts("malloced"); | |
do_free(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment