Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void f()
- {
- int *a = malloc(ASIZE);
- if(!a) goto END;
- int *b = malloc(BSIZE);
- if(!b) goto FREE_A;
- int **c = malloc(CSIZE);
- if(!c) goto FREE_B;
- int i;
- for(i=0; i<CSIZE; i++) {
- c[i] = malloc(N);
- if(!c[i]) goto FREE_C;
- }
- /* Do stuff */
- FREE_C:
- while(i>=0)
- free(c[i--]);
- free(c);
- FREE_B:
- free(b);
- FREE_A:
- free(a);
- END:
- }
- void f()
- {
- for(int i=0; i<A; i++) {
- for(int j=0; j<B; j++) {
- for(int k; k<B; k++) {
- if(condition)
- goto END;
- /* Do stuff */
- }
- }
- }
- END:
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement