[lrslib] Apply patch from Thomas Rehn to fix a memory leak.

Jerry James jjames at fedoraproject.org
Fri Mar 16 16:31:39 UTC 2012


commit 80913cae255250640625fb5f41891a3881387603
Author: Jerry James <loganjerry at gmail.com>
Date:   Fri Mar 16 10:31:29 2012 -0600

    Apply patch from Thomas Rehn to fix a memory leak.

 lrslib-memleak.patch |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 lrslib.spec          |    8 +++++++-
 2 files changed, 55 insertions(+), 1 deletions(-)
---
diff --git a/lrslib-memleak.patch b/lrslib-memleak.patch
new file mode 100644
index 0000000..38a5e84
--- /dev/null
+++ b/lrslib-memleak.patch
@@ -0,0 +1,48 @@
+--- ./lrslib.c.orig	2012-03-16 10:09:15.267578540 -0600
++++ ./lrslib.c	2012-03-16 10:16:13.688031425 -0600
+@@ -1396,7 +1396,8 @@ lrs_getfirstbasis (lrs_dic ** D_p, lrs_d
+     }
+   if (nredundcol > 0)
+     {
+-      *Lin = lrs_alloc_mp_matrix (nredundcol, Q->n);
++      const unsigned int Qn = Q->n;
++      *Lin = lrs_alloc_mp_matrix (nredundcol, Qn);
+ 
+       for (i = 0; i < nredundcol; i++)
+ 	{
+@@ -1406,7 +1407,10 @@ lrs_getfirstbasis (lrs_dic ** D_p, lrs_d
+ 	    }
+ 
+ 	  if (!removecobasicindex (D, Q, 0L))
+-	    return FALSE;
++	    {
++	      lrs_clear_mp_matrix (*Lin, nredundcol, Qn);
++	      return FALSE;
++	    }
+ 	}
+     }				/* end if nredundcol > 0 */
+ 
+--- ./nash.c.orig	2009-09-10 12:40:50.000000000 -0600
++++ ./nash.c	2012-03-16 10:15:44.760069250 -0600
+@@ -497,7 +497,8 @@ lrs_getfirstbasis2 (lrs_dic ** D_p, lrs_
+     }
+   if (nredundcol > 0)
+     {
+-      *Lin = lrs_alloc_mp_matrix (nredundcol, Q->n);
++      const unsigned int Qn = Q->n;
++      *Lin = lrs_alloc_mp_matrix (nredundcol, Qn);
+ 
+       for (i = 0; i < nredundcol; i++)
+ 	{
+@@ -507,7 +508,10 @@ lrs_getfirstbasis2 (lrs_dic ** D_p, lrs_
+ 	    }
+ 
+ 	  if (!removecobasicindex (D, Q, 0L))
+-	    return FALSE;
++	    {
++	      lrs_clear_mp_matrix (*Lin, nredundcol, Qn);
++	      return FALSE;
++	    }
+ 	}
+     }				/* end if nredundcol > 0 */
+ 
diff --git a/lrslib.spec b/lrslib.spec
index bc63e92..edb2163 100644
--- a/lrslib.spec
+++ b/lrslib.spec
@@ -1,6 +1,6 @@
 Name:           lrslib
 Version:        4.2c
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        Reverse search for vertex enumeration/convex hull problems
 
 %global upver 0%(echo %{version} | sed 's/\\.//')
@@ -14,6 +14,9 @@ Source1:        %{name}-man.tar.xz
 # This patch was sent upstream on 31 May 2011.  It fixes some miscellaneous
 # bugs and adapts to the naming scheme we choose for installation.
 Patch0:         %{name}-fixes.patch
+# This patch is from Thomas Rehn, who also sent the patch upstream.  It fixes
+# a memory leak.
+Patch1:         %{name}-memleak.patch
 
 BuildRequires:  gmp-devel
 
@@ -152,6 +155,9 @@ done
 %{_mandir}/man1/lrs*
 
 %changelog
+* Fri Mar 16 2012 Jerry James <loganjerry at gmail.com> - 4.2c-4
+- Apply patch from Thomas Rehn to fix a memory leak
+
 * Tue Feb 14 2012 Jerry James <loganjerry at gmail.com> - 4.2c-3
 - Change subpackage structure based on review
 


More information about the scm-commits mailing list