logo       

SWIG+Perl+C free() error and zero pointer on very simple script Bug # 10358: msg#00181

programming.swig

Subject: SWIG+Perl+C free() error and zero pointer on very simple script Bug # 1035817

This was submitted as BUG # 1035817 on Sourceforge.
Any insight is greatly appreciated.

We use SWIG to wrap some simple C code into a Perl
Module.

Using the module in a simple script produces an error
like
free(): invalid pointer 0x816c138!
Also a string seems to be improperly passed as a zero
pointer to the underlying C code.

To see the problem untar the attached file and execute
the following commands:

$ swig -perl SwigTest.i;

$ gcc -D_GNU_SOURCE -I/usr/include
-I/usr/local/include
-I/usr/lib/perl5/5.8.3/i586-linux-thread-multi/CORE -c
SwigTest_wrap.c SwigTest.c;
$ gcc -shared SwigTest.o SwigTest_wrap.o -o
swigTest.so;
$ ./SwigTest.pl

The problem occurs under the following Linux
environment
uname -a: i686, SuSE 9.1, kernel 2.6.5-7.108-default,
perl -v: v5.8.3 built for i586-linux-thread-multi,
swig -version: SWIG Version 1.3.21, Compiled with g++
[i686-pc-linux-gnu]

We don't really think it's environment specific as we
have similar problems on Sparc Solaris and with
various recent versions of SWIG and Perl including
Perl 5.8.5 and SWIG 1.3.22



__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail

Attachment: SwigTest.tar
Description: SwigTest.tar

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise