Re: [1/2] ddraw: release interfaces when exiting with error
21 Feb
2008
21 Feb
'08
8:13 p.m.
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; error: f(c) free(c); f(b) free(b); f(a) free(a); return FAIL;
6507
Age (days ago)
6507
Last active (days ago)
0 comments
1 participants
participants (1)
-
Stefan Dösinger