From bbdc34132583cd8a174869cdb55b82c8c05aeb45 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sat, 26 Jan 2013 16:24:43 +0000 Subject: [PATCH] Handle NULL in jid_destroy() --- src/jid.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/jid.c b/src/jid.c index 1798c987..0b468674 100644 --- a/src/jid.c +++ b/src/jid.c @@ -105,13 +105,15 @@ jid_create_room_jid(const char * const room, const char * const nick) void jid_destroy(Jid *jid) { - FREE_SET_NULL(jid->str); - FREE_SET_NULL(jid->localpart); - FREE_SET_NULL(jid->domainpart); - FREE_SET_NULL(jid->resourcepart); - FREE_SET_NULL(jid->barejid); - FREE_SET_NULL(jid->fulljid); - FREE_SET_NULL(jid); + if (jid != NULL) { + FREE_SET_NULL(jid->str); + FREE_SET_NULL(jid->localpart); + FREE_SET_NULL(jid->domainpart); + FREE_SET_NULL(jid->resourcepart); + FREE_SET_NULL(jid->barejid); + FREE_SET_NULL(jid->fulljid); + FREE_SET_NULL(jid); + } } gboolean