Skip to content

Commit

Permalink
websocket: use sizeof over the type of the pointer to be allocated
Browse files Browse the repository at this point in the history
(cherry picked from commit 145d10f)
  • Loading branch information
miconda committed Aug 29, 2017
1 parent ebe9387 commit efee462
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/modules/websocket/ws_frame.c
Expand Up @@ -209,13 +209,13 @@ static int encode_and_send_ws_frame(ws_frame_t *frame, conn_close_t conn_close)

/* Allocate send buffer and build frame */
frame_length = frame->payload_len + extended_length + 2;
if ((send_buf = pkg_malloc(sizeof(unsigned char) * frame_length))
if ((send_buf = pkg_malloc(sizeof(char) * frame_length))
== NULL)
{
LM_ERR("allocating send buffer from pkg memory\n");
return -1;
}
memset(send_buf, 0, sizeof(unsigned char) * frame_length);
memset(send_buf, 0, sizeof(char) * frame_length);
send_buf[pos++] = 0x80 | (frame->opcode & 0xff);
if (extended_length == 0)
send_buf[pos++] = (frame->payload_len & 0xff);
Expand Down

0 comments on commit efee462

Please sign in to comment.