summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cursor.c6
-rw-r--r--src/file.c9
-rw-r--r--src/library.c3
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);
}
diff --git a/src/file.c b/src/file.c
index 368961b..de78b05 100644
--- a/src/file.c
+++ b/src/file.c
@@ -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;
}