diff options
Diffstat (limited to 'ssh')
-rw-r--r-- | ssh/tomsg_clientlib.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/ssh/tomsg_clientlib.c b/ssh/tomsg_clientlib.c index 0108a38..daa2cf5 100644 --- a/ssh/tomsg_clientlib.c +++ b/ssh/tomsg_clientlib.c @@ -252,22 +252,22 @@ void tomsg_event_nullify(struct tomsg_event event) { case TOMSG_EV_REGISTER: case TOMSG_EV_LOGIN: - free(event.login.username); event.login.username = NULL; + free(event.login.username); break; case TOMSG_EV_INVITE: case TOMSG_EV_PUSH_JOIN: - free(event.join.room_name); event.join.room_name = NULL; - free(event.join.username); event.join.username = NULL; + free(event.join.room_name); + free(event.join.username); break; case TOMSG_EV_IS_ONLINE: case TOMSG_EV_PUSH_ONLINE: - free(event.is_online.username); event.is_online.username = NULL; + free(event.is_online.username); break; case TOMSG_EV_CREATE_ROOM: - free(event.create_room.room_name); event.create_room.room_name = NULL; + free(event.create_room.room_name); break; case TOMSG_EV_LIST_ROOMS: @@ -277,7 +277,6 @@ void tomsg_event_nullify(struct tomsg_event event) { } } free(event.list_rooms.rooms); - event.list_rooms.rooms = NULL; break; case TOMSG_EV_LIST_MEMBERS: @@ -287,28 +286,26 @@ void tomsg_event_nullify(struct tomsg_event event) { } } free(event.list_members.members); - event.list_members.members = NULL; break; case TOMSG_EV_HISTORY: - free(event.history.room_name); event.history.room_name = NULL; + free(event.history.room_name); if (event.history.messages != NULL) { for (int64_t i = 0; i < event.history.count; i++) { history_message_nullify(event.history.messages[i]); } } free(event.history.messages); - event.history.messages = NULL; break; case TOMSG_EV_PUSH_MESSAGE: - free(event.push_message.room_name); event.push_message.room_name = NULL; + free(event.push_message.room_name); history_message_nullify(event.push_message.message); break; case TOMSG_EV_PUSH_INVITE: - free(event.push_invite.room_name); event.push_invite.room_name = NULL; - free(event.push_invite.inviter); event.push_invite.inviter = NULL; + free(event.push_invite.room_name); + free(event.push_invite.inviter); break; } } |