e70425
From 5ef079e305fdfe7275e6a241704fb071f7c9345d Mon Sep 17 00:00:00 2001
e70425
From: "R. Clint Whaley" <whaley@cs.utsa.edu>
e70425
Date: Sat, 2 Nov 2013 13:04:29 -0500
e70425
Subject: [PATCH] fixed possible memory leek in threaded QR
e70425
e70425
---
e70425
 AtlasBase/Students/qr.base | 12 ++++++------
e70425
 1 file changed, 6 insertions(+), 6 deletions(-)
e70425
e70425
diff --git a/src/threads/lapack/ATL_tgeqr2.c b/src/threads/lapack/ATL_tgeqr2.c
e70425
index 2263042..daf44a9 100644
e70425
--- a/src/threads/lapack/ATL_tgeqr2.c   
e70425
+++ b/src/threads/lapack/ATL_tgeqr2.c
e70425
@@ -10372,7 +10372,7 @@ int ATL_tgexx2(int M, int N, TYPE *A, int LDA, TYPE *TAU, TYPE *WORK,
e70425
 /* We use a data-owner split, each thread gets 1/p of the data,               */
e70425
 /* and does all computation related to it.                                    */
e70425
 /*----------------------------------------------------------------------------*/
e70425
-   TYPE *myA = A, *myOldA = A, *allMem, *workMem;
e70425
+   TYPE *myA = A, *myOldA = A, *allMem=NULL, *workMem;
e70425
    int i, j, k, b0, b, th;
e70425
    long unsigned int CPU;
e70425
    size_t mem[ATL_NTHREADS], totmem, workSize;
e70425
@@ -10523,9 +10523,8 @@ int ATL_tgexx2(int M, int N, TYPE *A, int LDA, TYPE *TAU, TYPE *WORK,
e70425
    ATL_goparallel(th, ATL_geqr2Worker, ts, NULL);
e70425
 
e70425
e70425
-   #if defined(local_copy)
e70425
-   free(allMem);                            /* release copied area.           */
e70425
-   #endif                                   /* defined(local_copy)            */
e70425
+   if (allMem)
e70425
+      free(allMem);                         /* release copied area.           */
e70425
    free(workMem);                           /* release work area.             */
e70425
    return(0);                               /* Done with dgeqr2.              */
e70425
 }  /* END ATL_t_dgeqr2. */
e70425
diff --git a/src/threads/lapack/ATL_tgeql2.c b/src/threads/lapack/ATL_tgeql2.c
e70425
index 2263042..daf44a9 100644
e70425
--- a/src/threads/lapack/ATL_tgeql2.c   
e70425
+++ b/src/threads/lapack/ATL_tgeql2.c
e70425
@@ -11660,7 +11659,7 @@ int ATL_tgexx2(int M, int N, TYPE *A, int LDA, TYPE *TAU, TYPE *WORK,
e70425
 /* We use a data-owner split, each thread gets 1/p of the data,               */
e70425
 /* and does all computation related to it.                                    */
e70425
 /*----------------------------------------------------------------------------*/
e70425
-   TYPE *myA = A, *allMem, *workMem;
e70425
+   TYPE *myA = A, *allMem=NULL, *workMem;
e70425
    int i, j, k, b0, b, th;
e70425
    long unsigned int CPU;
e70425
    size_t mem[ATL_NTHREADS], totmem, workSize;
e70425
@@ -11823,7 +11822,8 @@ int ATL_tgexx2(int M, int N, TYPE *A, int LDA, TYPE *TAU, TYPE *WORK,
e70425
    ATL_goparallel(th, ATL_geql2Worker, ts, NULL);
e70425
e70425
 
e70425
-   if (myCopy) free(allMem);                /* release copied area.           */
e70425
+   if (allMem) 
e70425
+      free(allMem);                         /* release copied area.           */
e70425
    free(workMem);                           /* release work area.             */
e70425
    return(0);                               /* Done with dgeql2.              */
e70425
 } /* END ATL_t_dgeql2 */