I have a python program which calls a C function. I send some structures containing mutable characters to c functions and my c function fills the structure.
class myS(Structure):
fields = [(“x”, c_int),
(“buffer”, 100*c_char)]
I send this to C function and C function fills the value in this structure. My program works very fine but after return it throws an error
* glibc detected * python: free(): invalid next size (fast):
Subsequent execution of program shows one of the following 3 errors on little change in code(such as print “hi”).
* glibc detected * python: malloc(): invalid next size (fast):
* glibc detected * python: free(): invalid next size (fast):
segmentation fault
Please help me out. Thanks in advance.
You have corrupted the memory arena, plain and simple, possibly by writing beyond the end of the memory that was passed to the C function but, without seeing the source code, we’ll never know for sure.
That message only appears when
glibdetects that the memory allocation accounting information has been corrupted.