>>28
1) Learn C
2) Learn to write functions
3) Learn that GOTO is fucking useless
heres a better version of that code which doesn't use goto.
its shorter and easier to understand and modify.
You are a dumb fuck.
int alloc_some_things() { // this should be T but other poster is a fucking goto using idiot.
T * foo;
foo = malloc(sizeof(*foo));
if(foo) {
foo->member = malloc(sizeof(*foo->member));
if(foo->member) {
foo->another = malloc(sizeof(*foo->another));
if(foo->another) {
return foo; // THANK GOD WE ALLOCATED STUFF
}
free(foo->member);
}
free(foo);
}
return NULL; // learn C you fucking idiot.
}