<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_1_1455645909526_2499">Hi All,</div><div id="yui_3_16_0_1_1455645909526_2717"><br></div><div id="yui_3_16_0_1_1455645909526_2714" dir="ltr">I am getting seg fault sometimes on the uci_lookup_ptr() call. here is the way I call this function:</div><div id="yui_3_16_0_1_1455645909526_2730" dir="ltr">It happens I would say once every couple of hundred calls.</div><div id="yui_3_16_0_1_1455645909526_2735" dir="ltr">I appreciate if someone can help and guide me how to debug this issue.</div><div id="yui_3_16_0_1_1455645909526_2779" dir="ltr">I have tried it with uci package from 2016-02-02<br></div><div id="yui_3_16_0_1_1455645909526_2713" dir="ltr"><br></div><div id="yui_3_16_0_1_1455645909526_2677" dir="ltr">char *<br>get_uci_option_api (char* file_name , char* section_name , char* section_value , char* option_name)<br>{<br> struct uci_element *e;<br> struct uci_section *s = NULL;<br> struct uci_package *pkg;<br> struct uci_context *m_uci;<br> struct uci_ptr ptr;<br><br> m_uci = uci_alloc_context();<br> if (!m_uci)<br> return NULL;<br><br> uci_load ( m_uci , file_name , &pkg);<br> memset(&ptr,0,sizeof(struct uci_ptr));<br><br> ptr.option = NULL;<br> ptr.section = section_value;<br> ptr.package = file_name;<br> ptr.value = section_name;<br> if (!uci_lookup_ptr(pkg->ctx, &ptr , NULL , true))<br> {<br> s = ptr.s;<br> }<br> else<br> s = NULL;<br><br> if (!s)<br> return NULL;<br><br> uci_foreach_element (&s->options, e)<br> {<br> if (!strcmp (e->name, option_name))<br> {<br> struct uci_option *o = uci_to_option (e);<br> if (o->type == UCI_TYPE_STRING)<br> return o->v.string;<br> }<br> return NULL;<br>}<br></div><div id="yui_3_16_0_1_1455645909526_2813" dir="ltr"><br></div><div id="yui_3_16_0_1_1455645909526_2812" dir="ltr">Thanks,</div><div id="yui_3_16_0_1_1455645909526_2817" dir="ltr">Farid<br></div><div id="yui_3_16_0_1_1455645909526_2708" dir="ltr"> <br></div></div></body></html>