An exception occurred in the ubus_request->pending linked list

I use malloc() to request an <ubus_request> structure, and then call ubus_invoke_async() to communicate with other processes.
But sometimes my program occur segment fault.
Here are my send code:

static int ubus_async_request(UBUS_REQ_CTX* req_ctx)
    struct ubus_request *req=(struct ubus_request *)calloc(1,sizeof(struct ubus_request));
    ret = ubus_lookup_id(&(ubus_conn.ctx), req_ctx->obj_name, &obj_id);
    ret=ubus_invoke_async(&(ubus_conn.ctx), obj_id, req_ctx->method, msg, req);
    req->data_cb = ubus_async_request_data_cb;
    req->complete_cb = ubus_async_request_complete_cb;
    req->priv = req_ctx;
    ubus_complete_request_async(&(ubus_conn.ctx), req);
    return ret;

The segfault occurs at ubus_process_req_data()->__ubus_process_req_data()->_list_del()
I printed the information about req->pending as follows:

Under normal circumstances,req->pending 、req-> 、req->pending.prev should be equal
But now they have some strange values?

First thing I'd try is hooking gdb up to the process. It can save hours of staring at various lines of code.

Be sure that you can repro the bug with the built code. Changing compile / link options can shift memory around, so if it is a pointer / array issue the problem can go away.

I'm already using gdb, so I found that the problem was with _list_del().
You mean let me change the compiler optimization level?

Can you see "better" looking data in the linked-list structure before somehting corrupts it? For example, looking at reg->prev gives an address mmm and mmm->next takes you back to reg?

If so I'd set a watch on the block of memory that is reg to find out when it is being changed.

My comment on compiler options was in case you weren't already building for debug, so not relevant for now. Too many pointer bugs in my history have only appeared in the production target code. When building for debug optimisations can be disabled which alter what is on the stack, etc.