Skip to content

Commit

Permalink
Fixed crash when failing to find a send socket
Browse files Browse the repository at this point in the history
Bogus free was done in case of error to find a socket
Also, do not call raw callbacks for the BIN protocol
  • Loading branch information
eseanucristian committed Aug 17, 2015
1 parent ac7c05c commit b8f9c55
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions forward.h
Expand Up @@ -94,6 +94,9 @@ static inline int msg_send( struct socket_info* send_sock, int proto,
return -1;
}

out_buff.len = len;
out_buff.s = buf;

/* determin the send socket */
if (send_sock==0)
send_sock=get_send_socket(0, to, proto);
Expand All @@ -102,13 +105,11 @@ static inline int msg_send( struct socket_info* send_sock, int proto,
goto error;
}

out_buff.len = len;
out_buff.s = buf;

/* the raw processing callbacks are free to change whatever inside
* the buffer further use out_buff.s and at the end try to free out_buff.s
* if changed by callbacks */
run_post_raw_processing_cb(POST_RAW_PROCESSING,&out_buff, msg);
if (proto != PROTO_BIN)
run_post_raw_processing_cb(POST_RAW_PROCESSING,&out_buff, msg);

/* update the length for further processing */
len = out_buff.len;
Expand Down

0 comments on commit b8f9c55

Please sign in to comment.