[Libwebsockets] [libwebsockets] #87: Return value from callback is ignored

Trac trac at libwebsockets.org
Wed Oct 1 19:54:50 CEST 2014

#87: Return value from callback is ignored
  Reporter:  dimitrirostavo         |      Owner:
      Type:  defect                 |     Status:  new
  Priority:  major                  |  Milestone:  milestone1
 Component:  libwebsockets library  |    Version:  1.0
Resolution:                         |   Keywords:

Comment (by dimitrirostavo):

 Just added a little bit more here. I think the code should be more like

 if (wsi->protocol->callback)

                                 wsi, LWS_CALLBACK_ESTABLISHED,
                                           wsi->user_space, NULL, 0))
             lwsl_debug("handshake_0405: Callback return nonzero error\n");
             goto bail;

         return 0;

         /* free up his parsing allocations */

         if (wsi->u.hdr.ah)
         wsi->u.hdr.ah = NULL;

         return -1;
 }//end of handshake-0405 method.

 We need to set the allocated headers to NULL before to return because we
 try to free the same field inside server.c:282.

Ticket URL: <http://libwebsockets.org/trac/libwebsockets/ticket/87#comment:1>
libwebsockets <http://libwebsockets.org>
libwebsockets C library

More information about the Libwebsockets mailing list