Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void func() {
- int sock;
- FILE *file1, *file2;
- char *buf;
- sock = socket();
- if (!sock)
- goto out;
- file1 = fopen();
- if (!file1)
- goto out_sock;
- file2 = fopen();
- if (!file2)
- goto out_file1;
- buf = malloc();
- if (!buf)
- goto out_file2;
- /* do things */
- out_alloc:
- free(buf);
- out_file2:
- fclose(file2);
- out_file1:
- fclose(file1);
- out_sock:
- close(sock);
- out:
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement