<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div style="margin:0;">Dear!</div><div style="margin:0;">    I've tried to write configurations using UCI API in my projects, but they often cause my processes to crash, I don't know why£¿I hope you can help me¡£</div><div style="margin:0;">1¡¢platform£ºX86</div><div style="margin:0;">This is the information that my Program crashed</div><div style="margin:0;"><span style="color: rgb(46, 48, 51); font-family: Arial, 'Microsoft YaHei', Î¢ÈíÑźÚ, ËÎÌå, 'Malgun Gothic', Meiryo, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 240, 242); display: inline !important; float: none;">(gdb) where<br>#0  0x00007fef72046277 in raise () from /lib64/libc.so.6<br>#1  0x00007fef72047968 in abort () from /lib64/libc.so.6<br>#2  0x00007fef72088d37 in __libc_message () from /lib64/libc.so.6<br>#3  0x00007fef72091499 in _int_free () from /lib64/libc.so.6<br>#4  0x00007fef723df3ef in uci_free_element (e=0xa63d50) at /home/uci/list.c:72<br>#5  0x00007fef723df573 in uci_free_package (package=package@entry=0xa63380) at /home/uci/list.c:283<br>#6  0x00007fef723dfb0d in uci_cleanup (ctx=0xa64300) at /home/uci/libuci.c:126<br>#7  0x00007fef723dfb6b in uci_free_context (ctx=0xa64300) at /home/uci/libuci.c:80<br>#8  0x0000000000402876 in </span><span style="font-family: Arial, "Microsoft YaHei", Î¢ÈíÑźÚ, ËÎÌå, "Malgun Gothic", Meiryo, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 240, 242); display: inline !important; float: none; color: rgb(221, 64, 50);">uci_set_value </span><span style="color: rgb(46, 48, 51); font-family: Arial, 'Microsoft YaHei', Î¢ÈíÑźÚ, ËÎÌå, 'Malgun Gothic', Meiryo, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 240, 242); display: inline !important; float: none;">(path=0x40cf59 "/tmp/DataCollection/MODMAN", config=0x40cf51 "rundata", section=0x40cf43 "modmanruninfo", <br>    option=0x40cfbf "akMODMANVTxMuteOpenAMIP", value=0x61b780 <g_Mcastinfo> "0") at ft_uci.c:446<br>#9  0x0000000000403dec in Write_Mcast_Data (def=1) at ft_daq.c:166<br>#10 0x000000000040426e in main (argc=1, argv=0x7ffe84fa78c8) at ft_daq.c:264</span></div><div style="margin:0;"><span style="color: rgb(46, 48, 51); font-family: Arial, 'Microsoft YaHei', Î¢ÈíÑźÚ, ËÎÌå, 'Malgun Gothic', Meiryo, sans-serif; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 20px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(238, 240, 242); display: inline !important; float: none;"><br></span></div><div style="margin:0;">2¡¢This is the function that writes the configuration file,My program calls uci_set_value function 20 times for 1s.<br>/*****************************************************************/<br>void uci_set_value(char *path, char *config, char *section, char *option, char *value)<br>{<br>    struct uci_context *ctx = NULL;<br>    struct uci_ptr ptr;<br>    int ret = UCI_OK;<br>    char str[128] = {0};<br>    char filepath[128] = {0};<br><br>    ctx = uci_alloc_context();<br>    if (!ctx)<br>    {<br>        ULOG_ERR("uci_alloc_context error, config=%s,section=%s,option=%s,value=%s\n", config, section, option, value);<br>        return;<br>    }<br>    if (NULL != path)<br>    {<br>        uci_set_confdir(ctx, path);<br>    }<br>    <br>    memset(&ptr, 0, sizeof(ptr));<br>    memset(str, 0 , sizeof(str));<br>    sprintf(str, "%s.%s.%s=%s", config, section, option, value);<br>    <br>    if (uci_lookup_ptr(ctx, &ptr, str, true) != 0) <br>    {<br>        ULOG_ERR("uci_lookup_ptr error, str=%s\n", str);<br>        uci_free_context(ctx);<br>        return;<br>    }<br>    memset(filepath, 0, sizeof(filepath));<br>    sprintf(filepath, "%s/%s", path, config);<br> <br>    if ((0 != strcmp(ctx->confdir, path)) || (0 != strcmp(filepath, ptr.p->path)))<br>    {<br>        if (ptr.p)<br>        {<br>            uci_unload(ctx, ptr.p);    <br>        }<br>        uci_free_context(ctx);<br>        return;<br>    }<br>    <br>    ret = uci_set(ctx, &ptr);<br>    if (0 == ret)<br>    {<br>        ret = uci_commit(ctx, &ptr.p, false);<br>    }<br>    else<br>    {<br>        ULOG_ERR("uci_set error, str=%s\n", str);<br>    }<br>    <br>    if (ptr.p)<br>    {<br>        uci_unload(ctx, ptr.p);    <br>    }</div><div style="margin:0;"><span style="color: rgb(221, 64, 50);">// Program terminated with signal 6, Aborted.<br></span></div><div style="margin:0;"><span style="color: rgb(221, 64, 50);">    </span><span style="color: rgb(0, 0, 0);">uci_free_context(ctx);</span></div><div style="margin:0;"><br>    return ;<br>}</div><div style="margin:0;">/*****************************************************************/</div><div style="margin:0;"><br></div><div style="margin:0;">3¡¢My config file</div><div style="margin:0;">config modman 'modmanruninfo'<br>        option akTestDID 'unknown'<br>        option akTestUptime 'unknown'<br>        option akTestSatelliteNetworkID 'unknown'<br></div><div style="margin:0;">        akMODMANVTxMuteOpenAMIP 'unknown'</div></div><br><br><span title="neteasefooter"><p> </p></span>