[Libwebsockets] Correct way to initialize connect_info and context_info

Brice Hamon brice at ydotm.com
Tue Mar 24 01:50:32 CET 2020


This is a C question, not a LWS.
std::memset(&m_context_info, 0, sizeof(m_connect_info));

On Mon, Mar 23, 2020 at 8:38 PM Pranjali Chumbhale <pranjalic at safeai.ai>
wrote:

> Hello team,
> This is how I initialize the connect info and context info in my case:
> std::memset(m_context_info, 0, sizeof(*m_context_info));
> std::memset(m_context_info, 0, sizeof(*m_connect_info));
> Following is my gdb debug log.
>
> (gdb) print(m_connect_info->address)
> $4 = 0x894801c083480027 <error: Cannot access memory at address
> 0x894801c083480027>
> (gdb) print(m_connect_info->address)
> $5 = 0x894801c083480027 <error: Cannot access memory at address
> 0x894801c083480027>
> (gdb) print(m_connect_info)
> $6 = (lws_client_connect_info *) 0x55d9eb7820f4
>      <std::_Tuple_impl<0ul, testing::internal::GTestFlagSaver*,
> std::default_delete<testing::internal::GTestFlagSaver>
> >::_M_head(std::_Tuple_impl<0ul, testing::internal::GTestFlagSaver*,
> std::default_delete<testing::internal::GTestFlagSaver> >&)+42>
> (gdb) print(m_connect_info->address)
> $7 = 0x894801c083480027 <error: Cannot access memory at address
> 0x894801c083480027>
> (gdb) print(*m_connect_info.address)
> Cannot access memory at address 0x894801c083480027
>
> What am I missing?
>
> Regards,
> Pranjali
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20200323/510bbafd/attachment-0001.htm>


More information about the Libwebsockets mailing list