Mail Archives: cygwin/2004/02/17/05:52:08
------=_NextPart_000_000C_01C3F500.F944B2E0
Content-Type: text/plain;
charset="US-ASCII"
Content-Transfer-Encoding: 7bit
Hi Ian,
There was some memory allocation related funkiness in DBD::Pg that the attached
patch fixes. You can apply it to both 1.31 and 1.32_1.
Bug posted on CPAN:
http://rt.cpan.org/NoAuth/Bug.html?id=5357
--
Rafael
>-----Original Message-----
>From: Ian Sealy
>Sent: Monday, February 16, 2004 11:09 AM
>To: Cygwin<at>cygwin.com
>Subject: Re: DBD::Pg - $dbh->quote() causes core dump
>
>Dear all,
>
>> Is anyone using the DBD::Pg Perl module under Cygwin? I'm trying to use
>> it on Windows XP with Perl 5.8.2-1 and DBI 1.40. The Cygwin DLL version
>> is 1.5.7.
>>
>> The module seems to build OK, but lots of the tests fail. The most
>> serious (from my point of view, because I tried to use the module
>> anyway) is that $dbh->quote() causes a core dump:
[SNIP]
>>
>> Any idea what's wrong?
>
>I've just realised that I've missed out one bit of, perhaps crucial,
>information. I'm building DBD::Pg against PostgreSQL 7.4.1-3.
>
>Any ideas? Thanks in advance.
>
>Cheers,
>Ian
------=_NextPart_000_000C_01C3F500.F944B2E0
Content-Type: application/octet-stream;
name="DBD-Pg-1.31-cygwin.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="DBD-Pg-1.31-cygwin.patch"
diff -ruN DBD-Pg-1.31.orig/Pg.xs DBD-Pg-1.31/Pg.xs
--- DBD-Pg-1.31.orig/Pg.xs 2003-10-29 13:13:32.000000000 -0800
+++ DBD-Pg-1.31/Pg.xs 2004-02-17 01:55:03.000000000 -0800
@@ -70,7 +70,7 @@
=20
#TODO: make quote(foo, {type=3D>SQL_INTEGER}) work #rl
#TODO: make quote(foo, {pg_type=3D>DBD::Pg::PG_INTEGER}) work #rl
-void
+SV*
quote(dbh, to_quote_sv, type_sv=3DNullsv)
SV* dbh
SV* to_quote_sv
@@ -104,17 +104,19 @@
if (!SvOK(to_quote_sv)) {
quoted =3D "NULL";
len =3D 4;
- ST(0) =3D sv_2mortal(newSVpv(quoted,len));
+ RETVAL =3D newSVpvn(quoted,len);
} else {
if (SvMAGICAL(to_quote_sv))
mg_get(to_quote_sv);
=20
to_quote =3D SvPV(to_quote_sv, len);
quoted =3D type_info->quote(to_quote, len, &retlen);
- ST(0) =3D sv_2mortal(newSVpv(quoted, retlen));
- free (quoted);
+ RETVAL =3D newSVpvn(quoted, retlen);
+ Safefree (quoted);
}
}
+ OUTPUT:
+ RETVAL
=20
=20
=20
diff -ruN DBD-Pg-1.31.orig/quote.c DBD-Pg-1.31/quote.c
--- DBD-Pg-1.31.orig/quote.c 2003-10-29 13:13:32.000000000 -0800
+++ DBD-Pg-1.31/quote.c 2004-02-17 02:26:23.000000000 -0800
@@ -373,7 +373,7 @@
strcpy(dest,intermead);
strcat(dest,"\'");
=20
- safefree(intermead);
+ PQfreemem(intermead);
*retlen=3Dstrlen(result);
assert(*retlen+1 <=3D resultant_len+2);
=20=09
------=_NextPart_000_000C_01C3F500.F944B2E0
Content-Type: text/plain; charset=us-ascii
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
------=_NextPart_000_000C_01C3F500.F944B2E0--
- Raw text -