[qpid-cpp] Fixed memory leak in Perl bindings typemap.
Darryl L. Pierce
mcpierce at fedoraproject.org
Mon Jan 28 14:55:31 UTC 2013
commit 4921faa1b226f646733950f9acdd3d18c29467b2
Author: Darryl L. Pierce <dpierce at redhat.com>
Date: Mon Jan 28 09:54:55 2013 -0500
Fixed memory leak in Perl bindings typemap.
- Resolves: BZ#885149
...ixes-a-memory-leak-in-the-Perl-language-b.patch | 55 ++++++++++++++++++++
qpid-cpp.spec | 11 +++-
2 files changed, 64 insertions(+), 2 deletions(-)
---
diff --git a/03-QPID-4493-Fixes-a-memory-leak-in-the-Perl-language-b.patch b/03-QPID-4493-Fixes-a-memory-leak-in-the-Perl-language-b.patch
new file mode 100644
index 0000000..2e969b9
--- /dev/null
+++ b/03-QPID-4493-Fixes-a-memory-leak-in-the-Perl-language-b.patch
@@ -0,0 +1,55 @@
+From 1f70ff91f87cff4e78240d8288ab825a333a7f11 Mon Sep 17 00:00:00 2001
+From: "Darryl L. Pierce" <mcpierce at apache.org>
+Date: Mon, 28 Jan 2013 14:25:50 +0000
+Subject: [PATCH] QPID-4493: Fixes a memory leak in the Perl language bindings.
+
+Replaces creating hashes and arrays using a scalar type with the
+appropriate Perl API calls for creating a hash and an array.
+
+Submitted by: Jimmy Jones <jimmyjones2 at gmx.co.uk>
+
+git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1439422 13f79535-47bb-0310-9956-ffa450edef68
+---
+ qpid/cpp/bindings/swig_perl_typemaps.i | 12 ++++--------
+ 1 file changed, 4 insertions(+), 8 deletions(-)
+
+diff --git a/qpid/cpp/bindings/swig_perl_typemaps.i b/qpid/cpp/bindings/swig_perl_typemaps.i
+index 201e64b..f294183 100644
+--- a/qpid/cpp/bindings/swig_perl_typemaps.i
++++ b/qpid/cpp/bindings/swig_perl_typemaps.i
+@@ -119,28 +119,24 @@
+ }
+
+ SV* MapToPerl(const qpid::types::Variant::Map* map) {
+- SV *result = newSV(0);
+- HV *hv = (HV *)sv_2mortal((SV *)newHV());
++ HV *hv = newHV();
+ qpid::types::Variant::Map::const_iterator iter;
+ for (iter = map->begin(); iter != map->end(); iter++) {
+ const std::string key(iter->first);
+ SV* perlval = VariantToPerl(&(iter->second));
+ hv_store(hv, key.c_str(), key.size(), perlval, 0);
+ }
+- SvSetSV(result, newRV_noinc((SV *)hv));
+- return result;
++ return sv_2mortal(newRV_noinc((SV *)hv));
+ }
+
+ SV* ListToPerl(const qpid::types::Variant::List* list) {
+- SV* result = newSV(0);
+- AV* av = (AV *)sv_2mortal((SV *)newAV());
++ AV* av = newAV();
+ qpid::types::Variant::List::const_iterator iter;
+ for (iter = list->begin(); iter != list->end(); iter++) {
+ SV* perlval = VariantToPerl(&(*iter));
+ av_push(av, perlval);
+ }
+- SvSetSV(result, newRV_noinc((SV *)av));
+- return result;
++ return sv_2mortal(newRV_noinc((SV *)av));
+ }
+
+ void PerlToMap(SV* hash, qpid::types::Variant::Map* map) {
+--
+1.8.1
+
diff --git a/qpid-cpp.spec b/qpid-cpp.spec
index 5b47770..c001d91 100644
--- a/qpid-cpp.spec
+++ b/qpid-cpp.spec
@@ -30,7 +30,7 @@
Name: qpid-cpp
Version: 0.20
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Libraries for Qpid C++ client applications
License: ASL 2.0
URL: http://qpid.apache.org
@@ -69,6 +69,8 @@ BuildRequires: libaio-devel
Patch1: 01-Add-support-for-ARM-processors.patch
Patch2: 02-Fixed-db4-on-Fedora.patch
+# BZ#885149
+Patch3: 03-QPID-4493-Fixes-a-memory-leak-in-the-Perl-language-b.patch
%description
@@ -567,13 +569,14 @@ Management and diagnostic tools for Apache Qpid brokers and clients.
%setup -q -n qpid-%{version}
%setup -q -T -D -b 1 -n qpid-%{version}
+%patch3 -p2
+
# qpid-store
pushd ../store-%{version}.%{store_svnrev}
%patch1 -p1
%patch2 -p1
popd
-
%global perftests "qpid-perftest qpid-topic-listener qpid-topic-publisher qpid-latency-test qpid-client-test qpid-txtest"
%global rh_qpid_tests_failover "failover_soak run_failover_soak"
@@ -761,6 +764,10 @@ rm -rf %{buildroot}
%changelog
+* Mon Jan 28 2013 Darryl L. Pierce <dpierce at redhat.com> - 0.20-2
+- Fixed memory leak in Perl bindings typemap.
+- Resolves: BZ#885149
+
* Wed Jan 23 2013 Darryl L. Pierce <dpierce at redhat.com> - 0.20-1
- Rebased Qpid on release 0.20.
- Rebased Store on SVN revision 4521.
More information about the scm-commits
mailing list