[cmpi-bindings] Fix memory leaks

vcrhonek vcrhonek at fedoraproject.org
Wed Jan 30 12:39:04 UTC 2013


commit b65c3e9b57d5e9f5cb1305052d3d5871df9767da
Author: Vitezslav Crhonek <vcrhonek at redhat.com>
Date:   Wed Jan 30 13:38:54 2013 +0100

    Fix memory leaks

 cmpi-bindings-0.5.2-memory-leaks.patch |  161 ++++++++++++++++++++++++++++++++
 cmpi-bindings.spec                     |    9 ++-
 2 files changed, 169 insertions(+), 1 deletions(-)
---
diff --git a/cmpi-bindings-0.5.2-memory-leaks.patch b/cmpi-bindings-0.5.2-memory-leaks.patch
new file mode 100644
index 0000000..6fdb6a6
--- /dev/null
+++ b/cmpi-bindings-0.5.2-memory-leaks.patch
@@ -0,0 +1,161 @@
+diff -up cmpi-bindings-0.5.2/swig/cmpi_defs.i.orig cmpi-bindings-0.5.2/swig/cmpi_defs.i
+--- cmpi-bindings-0.5.2/swig/cmpi_defs.i.orig	2013-01-30 13:20:41.165030423 +0100
++++ cmpi-bindings-0.5.2/swig/cmpi_defs.i	2013-01-30 13:22:00.059470519 +0100
+@@ -78,16 +78,16 @@
+ # CMPIData
+ #
+ 
+-%extend CMPIData {
++%extend _CMPIData {
+ /*
+   type, state, value are created by SWIG via %include cmpidt above
+ 
+ */
+-  CMPIData(CMPIData *data)
++  _CMPIData(CMPIData *data)
+   {
+     return data_clone(data);
+   }
+-  ~CMPIData()
++  ~_CMPIData()
+   {
+     free($self);
+   }
+@@ -148,14 +148,14 @@
+ # CMPIStatus
+ #
+ 
+-%extend CMPIStatus {
+-  CMPIStatus()
++%extend _CMPIStatus {
++  _CMPIStatus()
+   {
+     CMPIStatus *status = (CMPIStatus *)calloc(1, sizeof(CMPIStatus));
+     status->rc = CMPI_RC_OK;
+     return status;
+   }
+-  ~CMPIStatus()
++  ~_CMPIStatus()
+   {
+     free( $self );
+   }
+diff -up cmpi-bindings-0.5.2/swig/cmpi_types.i.orig cmpi-bindings-0.5.2/swig/cmpi_types.i
+--- cmpi-bindings-0.5.2/swig/cmpi_types.i.orig	2013-01-30 13:22:15.724557905 +0100
++++ cmpi-bindings-0.5.2/swig/cmpi_types.i	2013-01-30 13:26:06.139843215 +0100
+@@ -40,7 +40,7 @@
+ # and the broker.
+ #
+ 
+-%nodefault CMPIError;
++%nodefault _CMPIError;
+ %rename(CMPIError) _CMPIError;
+ typedef struct _CMPIError {} CMPIError;
+ 
+@@ -116,14 +116,14 @@ typedef struct _CMPIException {} CMPIExc
+  * description
+  *
+  */
+-%extend CMPIException 
++%extend _CMPIException 
+ {
+   CMPIException() 
+   {
+       return (CMPIException*)calloc(1, sizeof(CMPIException));
+   }
+ 
+-  ~CMPIException() 
++  ~_CMPIException() 
+   {
+       free($self->description);
+       free($self);
+@@ -186,7 +186,7 @@ typedef struct _CMPIException {} CMPIExc
+  */
+ %extend _CMPIError 
+ {
+-  ~CMPIError() { }
++  ~_CMPIError() { }
+ 
+ /* Gets the type of this Error */
+   CMPIErrorType type() {
+@@ -420,12 +420,12 @@ typedef struct _CMPIException {} CMPIExc
+ {
+ #if HAVE_CMPI_BROKER
+ #if defined(SWIGRUBY)
+-  CMPIObjectPath(VALUE ns_t, VALUE cn_t = Qnil) /* Can't use Target_Type here, this is SWIG level */
++  _CMPIObjectPath(VALUE ns_t, VALUE cn_t = Qnil) /* Can't use Target_Type here, this is SWIG level */
+ #else
+-  CMPIObjectPath(const char *ns, const char *cn = NULL)
++  _CMPIObjectPath(const char *ns, const char *cn = NULL)
+ #endif
+ #else
+-  CMPIObjectPath(const CMPIBroker* broker, const char *ns, const char *cn = NULL)
++  _CMPIObjectPath(const CMPIBroker* broker, const char *ns, const char *cn = NULL)
+ #endif
+   {
+     CMPIStatus st = { CMPI_RC_OK, NULL };
+@@ -520,7 +520,7 @@ fail:
+     return path;
+   }
+ 
+-  ~CMPIObjectPath() 
++  ~_CMPIObjectPath() 
+   { 
+ /* FIXME    CMRelease( $self ); */
+   }
+@@ -852,9 +852,9 @@ FIXME: if clone() is exposed, release()
+ {
+   /* path: ObjectPath containing namespace and classname. */
+ #if HAVE_CMPI_BROKER
+-  CMPIInstance(CMPIObjectPath *path)
++  _CMPIInstance(CMPIObjectPath *path)
+ #else
+-  CMPIInstance(const CMPIBroker* broker, CMPIObjectPath *path)
++  _CMPIInstance(const CMPIBroker* broker, CMPIObjectPath *path)
+ #endif
+   {
+     CMPIInstance *instance;
+@@ -867,7 +867,7 @@ FIXME: if clone() is exposed, release()
+     return instance;
+   }
+ 
+-  ~CMPIInstance() 
++  ~_CMPIInstance() 
+   { 
+ /* FIXME    CMRelease( $self ); */
+   }
+@@ -1145,7 +1145,7 @@ FIXME: if clone() is exposed, release()
+  */
+ %extend _CMPIArgs 
+ {
+-  ~CMPIArgs() 
++  ~_CMPIArgs() 
+   { 
+     CMRelease( $self );
+   }
+@@ -1257,7 +1257,7 @@ FIXME: if clone() is exposed, release()
+  *       and provides mechanism to operate on the query.
+  */
+ %extend _CMPISelectExp {
+-  ~CMPISelectExp()
++  ~_CMPISelectExp()
+   {
+     CMRelease( $self );
+   }
+@@ -1359,7 +1359,7 @@ FIXME: if clone() is exposed, release()
+  */
+ %extend _CMPIEnumeration 
+ {
+-  ~_CMPIEumeration() {
++  ~_CMPIEnumeration() {
+     CMRelease( $self );
+   }
+ #if defined(SWIGPYTHON)
+@@ -1600,7 +1600,7 @@ Python for compatibility */
+  *
+  */
+ %extend _CMPIDateTime {
+-  ~CMPIDateTime()
++  ~_CMPIDateTime()
+   {
+     CMRelease( $self );
+   }
diff --git a/cmpi-bindings.spec b/cmpi-bindings.spec
index f8d5e3f..f73f9da 100644
--- a/cmpi-bindings.spec
+++ b/cmpi-bindings.spec
@@ -1,6 +1,6 @@
 Name:           cmpi-bindings
 Version:        0.5.2
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        Adapter to write and run CMPI-type CIM providers
 
 Group:          Development/Libraries
@@ -21,6 +21,8 @@ Patch1:         cmpi-bindings-0.4.17-sblim-sigsegv.patch
 Patch2:         cmpi-bindings-0.5.2-null.patch
 #Patch3: bz#883462, adds bindings for CMTraceMessage
 Patch3:         cmpi-bindings-0.5.2-trace.patch
+#Patch4: bz#902809, taken from upstream
+Patch4:         cmpi-bindings-0.5.2-memory-leaks.patch
 
 BuildRequires:  cmake gcc-c++ swig >= 1.3.34
 BuildRequires:  curl-devel pkgconfig sed
@@ -46,6 +48,7 @@ CMPI-compliant provider interface for Python
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
+%patch4 -p1
 
 # change hardcoded path from /usr/lib/pycim/ to something better
 sed -i 's@/usr/lib/pycim/@'`echo %{python_sitelib}/pycim/`'@' swig/python/cmpi_pywbem_bindings.py
@@ -98,6 +101,10 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Wed Jan 30 2013 Vitezslav Crhonek <vcrhonek at redhat.com> - 0.5.2-4
+- Fix memory leaks
+  Resolves: #902809
+
 * Thu Jan 10 2013 Vitezslav Crhonek <vcrhonek at redhat.com> - 0.5.2-3
 - Fixed passing NULL array from get_instance
 - Add bindings for CMTraceMessage


More information about the scm-commits mailing list