Skip to content

Instantly share code, notes, and snippets.

@drrost
Created April 21, 2020 15:25
Show Gist options
  • Save drrost/95051eae6bfce44c76d1de535d5cadea to your computer and use it in GitHub Desktop.
Save drrost/95051eae6bfce44c76d1de535d5cadea to your computer and use it in GitHub Desktop.
A simple example of memory leak
#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