core: Fixed segmentation fault
authorPeter Dunkley <peter.dunkley@crocodile-rcs.com>
Sat, 30 Jun 2012 19:35:10 +0000 (20:35 +0100)
committerPeter Dunkley <peter.dunkley@crocodile-rcs.com>
Sat, 30 Jun 2012 19:35:10 +0000 (20:35 +0100)
- Tiny window for this...  but I hit it when Google Chrome crashed during
  a WebSocket session

forward.h

index 02cfd12..2b9ae78 100644 (file)
--- a/forward.h
+++ b/forward.h
@@ -164,6 +164,12 @@ static inline int msg_send(struct dest_info* dst, char* buf, int len)
                        return -1;
                }
 
+               if (con == NULL)
+               {
+                       LM_WARN("TCP/TLS connection for WebSocket could not be found\n");
+                       return -1;
+               }
+
                memset(&wsev, 0, sizeof(ws_event_info_t));
                wsev.type = SREV_TCP_WS_FRAME_OUT;
                wsev.buf = outb.s;