[libdbd-pg-perl] 12/35: Fix leak in ->state methods (GH #30)

Christoph Berg myon at debian.org
Wed Sep 27 17:41:03 UTC 2017


This is an automated email from the git hooks/post-receive script.

myon pushed a commit to branch master
in repository libdbd-pg-perl.

commit 5039252e17cab7638b4a33bfd3e08ec9a4189419
Author: Dagfinn Ilmari Mannsåker <ilmari at ilmari.org>
Date:   Wed Sep 20 16:54:06 2017 +0100

    Fix leak in ->state methods (GH #30)
---
 Changes | 3 +++
 Pg.xs   | 8 ++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/Changes b/Changes
index f23ca78..3ec4e6f 100644
--- a/Changes
+++ b/Changes
@@ -7,6 +7,9 @@
     [David Christensen, reported by Marko Tiikkaja]
   - Fix crash with missing server_version
     [David Christensen]
+  - Fix leak in ->state methods
+    [Dagfinn Ilmari Mannsåker]
+    (Github issue #30)
 
 Version 3.6.2  Released May 23, 2017 (git tag 3.6.2)
 
diff --git a/Pg.xs b/Pg.xs
index edeb6af..89ff68b 100644
--- a/Pg.xs
+++ b/Pg.xs
@@ -311,7 +311,9 @@ void state(dbh)
 	SV *dbh
 	CODE:
 	D_imp_dbh(dbh);
-	ST(0) = strEQ(imp_dbh->sqlstate,"00000") ? &PL_sv_no : newSVpv(imp_dbh->sqlstate, 5);
+	ST(0) = strEQ(imp_dbh->sqlstate,"00000")
+          ? &PL_sv_no
+          : sv_2mortal(newSVpv(imp_dbh->sqlstate, 5));
 
 
 void do(dbh, statement, attr=Nullsv, ...)
@@ -830,7 +832,9 @@ SV *sth;
 	CODE:
 		D_imp_sth(sth);
 		D_imp_dbh_from_sth;
-		ST(0) = strEQ(imp_dbh->sqlstate,"00000") ? &PL_sv_no : newSVpv(imp_dbh->sqlstate, 5);
+		ST(0) = strEQ(imp_dbh->sqlstate,"00000")
+                  ? &PL_sv_no
+                  : sv_2mortal(newSVpv(imp_dbh->sqlstate, 5));
 
 void
 pg_ready(sth)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libdbd-pg-perl.git



More information about the Pkg-perl-cvs-commits mailing list