[1/2] ddraw: release interfaces when exiting with error

Stefan Dösinger stefandoesinger at gmx.at
Thu Feb 21 11:13:08 CST 2008

Am Mittwoch, 20. Februar 2008 22:03:51 schrieben Sie:
> ---
>   dlls/ddraw/texture.c |    2 ++
>   1 files changed, 2 insertions(+), 0 deletions(-)
Just a general comment(not specific to comments): For such cleanup work it 
works quite nice to use goto(!), as shown below. Your patch is OK as it is, 
but I think its a good idea to use this scheme in all places because it helps 
to prevent new problems from coming in when the code is changed.

void *a = NULL, *b = NULL, *c = NULL;

a = malloc(10);
if(!a) goto error;
b = malloc(10);
if(!b) goto error;
c = malloc(10);
if(!c) goto error;
if(dosomethingelse() == FAIL) goto error;

return SUCCESS;

f(c) free(c);
f(b) free(b);
f(a) free(a);
return FAIL;

More information about the wine-devel mailing list