diff options
author | Chris Wilson <cpwilson@taz.qinetiq.com> | 2006-08-12 19:55:44 +0300 |
---|---|---|
committer | Daniel Stone <daniels@endtroducing.fooishbar.org> | 2006-08-12 19:55:44 +0300 |
commit | e0a501e91c270c0e99a55aa568f6df0d3d6e541d (patch) | |
tree | e5b7c328b10d3b7a974e880df8e3ef7b63dc0a17 /src | |
parent | 2f08984396552c0719fbc3d3e1148157a1423376 (diff) |
fix leak in header destruction
Fix a couple of if (!foo) free(foo); tests.
Diffstat (limited to 'src')
-rw-r--r-- | src/cursor.c | 6 | ||||
-rw-r--r-- | src/file.c | 9 | ||||
-rw-r--r-- | src/library.c | 3 |
3 files changed, 10 insertions, 8 deletions
diff --git a/src/cursor.c b/src/cursor.c index 16c65ea..954fda4 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -47,6 +47,9 @@ XcursorCursorsDestroy (XcursorCursors *cursors) { int n; + if (!cursors) + return; + --cursors->ref; if (cursors->ref > 0) return; @@ -73,6 +76,9 @@ XcursorAnimateCreate (XcursorCursors *cursors) void XcursorAnimateDestroy (XcursorAnimate *animate) { + if (!animate) + return; + XcursorCursorsDestroy (animate->cursors); free (animate); } @@ -47,8 +47,7 @@ XcursorImageCreate (int width, int height) void XcursorImageDestroy (XcursorImage *image) { - if (image) - free (image); + free (image); } XcursorImages * @@ -121,8 +120,7 @@ XcursorCommentCreate (XcursorUInt comment_type, int length) void XcursorCommentDestroy (XcursorComment *comment) { - if (!comment) - free (comment); + free (comment); } XcursorComments * @@ -205,8 +203,7 @@ _XcursorWriteBytes (XcursorFile *file, char *bytes, int length) static void _XcursorFileHeaderDestroy (XcursorFileHeader *fileHeader) { - if (!fileHeader) - free (fileHeader); + free (fileHeader); } static XcursorFileHeader * diff --git a/src/library.c b/src/library.c index 8cbc949..3c058ef 100644 --- a/src/library.c +++ b/src/library.c @@ -263,8 +263,7 @@ XcursorScanTheme (const char *theme, const char *name) */ for (i = inherits; i && f == 0; i = _XcursorNextPath (i)) f = XcursorScanTheme (i, name); - if (inherits) - free (inherits); + free (inherits); return f; } |