Advertisement
amitrk23

test_malloc_rquinn

Nov 12th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. // Basic test
  2.  
  3. #include <stdio.h>
  4. #include <malloc.h>
  5.  
  6. int main(){
  7. char *a, *b, *c;
  8. int i = 0 ;
  9. a = malloc(5);
  10. for (i = 0 ; i < 10; i++){
  11. b = malloc(1); // Seg fault occurs here
  12. }
  13. free(a);
  14. free(b);
  15.  
  16. return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement