[question] why crash while adding property to an object using ctypes ?

hi
I want to add an array property to an object.I can do it simply by python like this:
oA=bpy.context.active_object
oA[“IDP_New_”]=[2,3]

but when I using C++ with ctype to do that like this, I excute the python script then It crash immediately:
the C++ file: test.cpp, (after setting up the Environment It was compiled as a dll file).

//----compile as test.dll------------------------------------------------------------
extern "C" __declspec(dllexport) void AddArrayAtrri(Object*o)
{
    if(!IDP_GetPropertyFromGroup(idp, "IDP_New_"))
    {
        ID id物=o->id;IDProperty*idp=id物.properties;
        IDPropertyTemplate val ={0};
        val.array.len =2;val.array.type = IDP_INT;
        IDProperty *idpARRAY=IDP_New(IDP_ARRAY,&val,"IDP_New_");
        int *Li2 = (int *)IDP_Array(idpARRAY);
        Li2[0]=12;Li2[1]=35;//adding value to the array
        IDP_AddToGroup(idp, idpARRAY);
        //IDP_FreeProperty(idpARRAY);MEM_freeN(idpARRAY);//sould I do this?
    }
        
}

the python file: test.py


import bpy
from ctypes import*
from ctypes.wintypes import *
#----load test.dll------------------------------------------------------------
dllpath="C:/test.dll"
DLL= CDLL(dllpath)
#----excute  test.dll------------------------------------------------------------
oA=bpy.context.active_object
cvp=c_void_p(oA.as_pointer())
DLL.AddArrayAtrri(cvp)  #add array by C++
print("oA[IDP_New_]==",oA["IDP_New_"]);#out put :<bpy id property array [2]>
#----add array by py----------------------------------------------------------
oA["PY_New_"]=[2,3]
print("oA[PY_New_]==",oA["PY_New_"]);#out put :<bpy id property array [2]>
#----realse test.dll------------------------------------------------------------
windll.kernel32.FreeLibrary.argtypes = [HMODULE]
windll.kernel32.FreeLibrary(DLL._handle)  #realse dll from ram
print("realse dll~~~")
DLL=None

I run the script It prints the information correctly for the first time, but when I run the second time It crash immediately.
I don’t know what’s wrong with it.

here is the screenshot of crash:

Now I can confirm that after excuting the script, if I change the current active object to other one will cause crash.