rendered paste bodyint func()
{
Pointer *a = NULL, *b = NULL, *c = NULL;
a = new_a();
if (!a) goto cleanup;
b = new_b();
if (!b) goto cleanup;
c = new_c();
if (!c) goto cleanup;
/* ... */
if (some_other_error) goto cleanup;
return 1;
cleanup:
if (a) free(a);
if (b) free(b);
if (c) free(c);
return 0;
}
int func2()
{
Pointer *a = NULL, *b = NULL, *c = NULL;
a = new_a();
if (!a) goto cleanup;
b = new_b();
if (!b) goto cleanup_a;
c = new_c();
if (!c) goto cleanup_b;
/* ... */
if (some_other_error) goto cleanup_c;
return 1;
cleanup_c: free(c);
cleanup_b: free(b);
cleanup_a: free(a);
cleanup:
return 0;
}