lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Is LWIP_SUPPORT_CUSTOM_PBUF functionality proper ?


From: Arpit Agarwal
Subject: Re: [lwip-users] Is LWIP_SUPPORT_CUSTOM_PBUF functionality proper ?
Date: Mon, 07 Nov 2016 07:05:39 +0000

Hi,

Sorry for the 1st query, I think typecasting is proper.

But Still I am unable to figure out Why Assertion fails happen or in which scenario it can happen.

Thanks,

Arpit

 

--------- Original Message ---------

Sender : Arpit Agarwal <address@hidden> Senior Software Engineer/SRI-Bangalore-IoTivity/Samsung Electronics

Date : 2016-11-07 11:50 (GMT+5:30)

Title : Is LWIP_SUPPORT_CUSTOM_PBUF functionality proper ?

 

 

Hello All,

I am facing assertion fail issue in pbuf_free API. The code where assert fails is mentioned below.

if ((p->flags & PBUF_FLAG_IS_CUSTOM) != 0)
      {
        struct pbuf_custom *pc = (struct pbuf_custom *)p;
        LWIP_ASSERT("pc->custom_free_function != NULL",
                    pc->custom_free_function != NULL);
        pc->custom_free_function(p);
      }

 

I have two queries :

1. Is it proper to typecast struct pbuf to struct pbuf_custom as in above code "struct pbuf_custom *pc = (struct pbuf_custom *)p;", as if the condition in if statement is true, then pbuf "p" should be a member of some struct of type pbuf_custom and hence typecasting like this is improper.

2. If the typecasting is proper:

Although its good to have assertion check, but may I know in which scenario this assertion can fail ? Because whenever the flag PBUF_FLAG_IS_CUSTOM is set only at one place i.e. in "pbuf_alloced_custom" API, and if that API returns properly, then custom_free_function member of strct pbuf_custom is always set to "ipfrag_free_pbuf_custom" and hence assertion fail should not happen.

Please help me out where I am going wrong in my understanding.

 

Thanks,

Arpit

 

Thanks & Regards,

Arpit Agarwal

Senior Software Engineer, SRIB

Email: address@hidden


reply via email to

[Prev in Thread] Current Thread [Next in Thread]