/pidgin/main: 7240fd8e3462: free() and g_free() are specified to...
Michael McConville
mmcconville at mykolab.com
Wed Oct 21 09:45:20 EDT 2015
Changeset: 7240fd8e34621f90b31ece6268ef0d40f391605c
Author: Michael McConville <mmcconville at mykolab.com>
Date: 2015-10-21 09:44 -0400
Branch: default
URL: https://hg.pidgin.im/pidgin/main/rev/7240fd8e3462
Description:
free() and g_free() are specified to be NULL-safe. Remove NULL checks.
diffstat:
libpurple/protocols/mxit/client.c | 11 +--------
libpurple/protocols/novell/nmconference.c | 4 +--
libpurple/protocols/novell/nmconn.c | 4 +--
libpurple/protocols/novell/nmcontact.c | 13 ++---------
libpurple/protocols/novell/nmuser.c | 4 +--
libpurple/protocols/novell/nmuserrecord.c | 34 ++++++------------------------
libpurple/protocols/sametime/sametime.c | 4 +--
libpurple/protocols/zephyr/ZAsyncLocate.c | 4 +-
libpurple/protocols/zephyr/Zinternal.c | 9 ++-----
9 files changed, 21 insertions(+), 66 deletions(-)
diffs (184 lines):
diff --git a/libpurple/protocols/mxit/client.c b/libpurple/protocols/mxit/client.c
--- a/libpurple/protocols/mxit/client.c
+++ b/libpurple/protocols/mxit/client.c
@@ -2939,16 +2939,9 @@ void mxit_close_connection( struct MXitS
g_list_free( session->invites );
session->invites = NULL;
- /* free profile information */
- if ( session->profile )
- free( session->profile );
-
- /* free custom emoticons */
+ free( session->profile );
mxit_free_emoticon_cache( session );
-
- /* free allocated memory */
- if ( session->uid )
- g_free( session->uid );
+ g_free( session->uid );
g_free( session->encpwd );
session->encpwd = NULL;
diff --git a/libpurple/protocols/novell/nmconference.c b/libpurple/protocols/novell/nmconference.c
--- a/libpurple/protocols/novell/nmconference.c
+++ b/libpurple/protocols/novell/nmconference.c
@@ -192,9 +192,7 @@ nm_conference_set_guid(NMConference * co
if (conference) {
/* Release memory for old guid */
- if (conference->guid) {
- g_free(conference->guid);
- }
+ g_free(conference->guid);
/* Set the new guid */
if (guid)
diff --git a/libpurple/protocols/novell/nmconn.c b/libpurple/protocols/novell/nmconn.c
--- a/libpurple/protocols/novell/nmconn.c
+++ b/libpurple/protocols/novell/nmconn.c
@@ -631,9 +631,7 @@ nm_read_fields(NMConn * conn, int count,
} while ((type != 0) && (count != 0));
- if (str != NULL) {
- g_free(str);
- }
+ g_free(str);
if (sub_fields != NULL) {
nm_free_fields(&sub_fields);
diff --git a/libpurple/protocols/novell/nmcontact.c b/libpurple/protocols/novell/nmcontact.c
--- a/libpurple/protocols/novell/nmcontact.c
+++ b/libpurple/protocols/novell/nmcontact.c
@@ -232,13 +232,8 @@ nm_release_contact(NMContact * contact)
purple_debug(PURPLE_DEBUG_INFO, "novell",
"Releasing contact, total=%d\n", --count);
- if (contact->display_name) {
- g_free(contact->display_name);
- }
-
- if (contact->dn) {
- g_free(contact->dn);
- }
+ g_free(contact->display_name);
+ g_free(contact->dn);
if (contact->user_record) {
nm_release_user_record(contact->user_record);
@@ -560,9 +555,7 @@ nm_release_folder(NMFolder * folder)
return;
if (--(folder->ref_count) == 0) {
- if (folder->name) {
- g_free(folder->name);
- }
+ g_free(folder->name);
if (folder->folders) {
_release_folder_folders(folder);
diff --git a/libpurple/protocols/novell/nmuser.c b/libpurple/protocols/novell/nmuser.c
--- a/libpurple/protocols/novell/nmuser.c
+++ b/libpurple/protocols/novell/nmuser.c
@@ -97,9 +97,7 @@ nm_deinitialize_user(NMUser * user)
g_hash_table_destroy(user->display_id_to_dn);
}
- if (user->name) {
- g_free(user->name);
- }
+ g_free(user->name);
if (user->user_record) {
nm_release_user_record(user->user_record);
diff --git a/libpurple/protocols/novell/nmuserrecord.c b/libpurple/protocols/novell/nmuserrecord.c
--- a/libpurple/protocols/novell/nmuserrecord.c
+++ b/libpurple/protocols/novell/nmuserrecord.c
@@ -282,33 +282,13 @@ nm_release_user_record(NMUserRecord * us
purple_debug(PURPLE_DEBUG_INFO, "novell",
"Releasing user_record, total=%d\n", --count);
- if (user_record->dn) {
- g_free(user_record->dn);
- }
-
- if (user_record->cn) {
- g_free(user_record->cn);
- }
-
- if (user_record->display_id) {
- g_free(user_record->display_id);
- }
-
- if (user_record->fname) {
- g_free(user_record->fname);
- }
-
- if (user_record->lname) {
- g_free(user_record->lname);
- }
-
- if (user_record->full_name) {
- g_free(user_record->full_name);
- }
-
- if (user_record->status_text) {
- g_free(user_record->status_text);
- }
+ g_free(user_record->dn);
+ g_free(user_record->cn);
+ g_free(user_record->display_id);
+ g_free(user_record->fname);
+ g_free(user_record->lname);
+ g_free(user_record->full_name);
+ g_free(user_record->status_text);
nm_free_fields(&user_record->fields);
diff --git a/libpurple/protocols/sametime/sametime.c b/libpurple/protocols/sametime/sametime.c
--- a/libpurple/protocols/sametime/sametime.c
+++ b/libpurple/protocols/sametime/sametime.c
@@ -4279,9 +4279,7 @@ static void notify_add(PurpleConnection
static void notify_close(gpointer data) {
- if (data) {
- g_free(data);
- }
+ g_free(data);
}
diff --git a/libpurple/protocols/zephyr/ZAsyncLocate.c b/libpurple/protocols/zephyr/ZAsyncLocate.c
--- a/libpurple/protocols/zephyr/ZAsyncLocate.c
+++ b/libpurple/protocols/zephyr/ZAsyncLocate.c
@@ -162,7 +162,7 @@ void ZFreeALD(zald)
{
if (!zald) return;
- if (zald->user) free(zald->user);
- if (zald->version) free(zald->version);
+ free(zald->user);
+ free(zald->version);
(void) memset(zald, 0, sizeof(*zald));
}
diff --git a/libpurple/protocols/zephyr/Zinternal.c b/libpurple/protocols/zephyr/Zinternal.c
--- a/libpurple/protocols/zephyr/Zinternal.c
+++ b/libpurple/protocols/zephyr/Zinternal.c
@@ -819,12 +819,9 @@ void Z_RemQueue(qptr)
__Q_Size -= qptr->msg_len;
- if (qptr->header)
- free(qptr->header);
- if (qptr->msg)
- free(qptr->msg);
- if (qptr->packet)
- free(qptr->packet);
+ free(qptr->header);
+ free(qptr->msg);
+ free(qptr->packet);
hole = qptr->holelist;
while (hole) {
More information about the Commits
mailing list