From b8f9c559678f6748d355efe283d07c5535b5f302 Mon Sep 17 00:00:00 2001 From: Eseanu Marius Cristian Date: Fri, 17 Jul 2015 12:32:22 +0300 Subject: [PATCH] Fixed crash when failing to find a send socket Bogus free was done in case of error to find a socket Also, do not call raw callbacks for the BIN protocol --- forward.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/forward.h b/forward.h index 4a093624e81..f226cb3b964 100644 --- a/forward.h +++ b/forward.h @@ -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); @@ -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;