aboutsummaryrefslogtreecommitdiff
path: root/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'command.c')
-rw-r--r--command.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/command.c b/command.c
index 1cd8619..8fa343d 100644
--- a/command.c
+++ b/command.c
@@ -191,7 +191,7 @@ static struct cmd_retval cmd_invite(struct conn_data *data,const char *tag,const
db_add_member(roomid,user2);
- const char *inviter_username=db_get_username(data->userid);
+ char *inviter_username=db_get_username(data->userid);
const char *username=args[1];
char *joinbuf=NULL;
@@ -199,6 +199,8 @@ static struct cmd_retval cmd_invite(struct conn_data *data,const char *tag,const
char *invitebuf=NULL;
i64 invitebuflen=asprintf(&invitebuf,"_push invite %s %s\n",roomname,inviter_username);
+ free(inviter_username);
+
event_emit_join(make_timestamp(),username,roomname);
struct db_user_list members=db_list_members(roomid);
@@ -318,6 +320,7 @@ static struct cmd_retval history_cmd_helper(
len=asprintf(&buf,"%s history_message %" PRIi64 " %s %s %" PRIi64 " %" PRIi64 " %s\n",
tag,ml.count-1-i,roomname,username,ml.list[i].timestamp,
ml.list[i].msgid,ml.list[i].message);
+ free(username);
closed=net_send_raw_text(data->fd,buf,len);
free(buf);
if(closed)break;