Created
April 21, 2020 15:25
-
-
Save drrost/95051eae6bfce44c76d1de535d5cadea to your computer and use it in GitHub Desktop.
A simple example of memory leak
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 <stdio.h> | |
#include <stdlib.h> | |
int main(void) { | |
char *p = (char *) malloc(12); | |
p = 0; // the leak is here | |
printf("Hello, leak!\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment