[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2b4-187-gf291cee

Service Account noreply at mpich.org
Thu Aug 20 10:37:09 CDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  f291cee1c7e7905875bbd7d464752532b0bc8379 (commit)
      from  e74901c335bcc9877006d53d4bd76f2490513027 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/f291cee1c7e7905875bbd7d464752532b0bc8379

commit f291cee1c7e7905875bbd7d464752532b0bc8379
Author: Ken Raffenetti <raffenet at mcs.anl.gov>
Date:   Wed Aug 19 10:31:42 2015 -0500

    binding/mpif_h: fix memory leak
    
    Guard alloc/free of temporary buffer for instances where it is not
    needed.
    
    Signed-off-by: Junchao Zhang <jczhang at mcs.anl.gov>

diff --git a/src/binding/fortran/mpif_h/buildiface b/src/binding/fortran/mpif_h/buildiface
index f6571fb..cd47698 100755
--- a/src/binding/fortran/mpif_h/buildiface
+++ b/src/binding/fortran/mpif_h/buildiface
@@ -3325,7 +3325,7 @@ sub chararray_ftoc {
     }
     print $OUTFD "\
       p$count = (char **)$malloc( asize$count * sizeof(char *) );
-      ptmp    = (char *)$malloc( asize$count * (d$count + 1) );
+      if (asize$count-1 > 0) ptmp = (char *)$malloc( asize$count * (d$count + 1) );
       for (i=0; i<asize$count-1; i++) {
           char *p = v$count + i * d$count, *pin, *pdest;
           int j;
@@ -3342,7 +3342,7 @@ sub chararray_ftoc {
     /* Null terminate the array */
     p$count\[asize$count-1\] = 0;
     }\n";
-    $clean_up .= "    $free( p$count\[0\] );\n    $free( p$count );\n";
+    $clean_up .= "    if (asize$count-1 > 0) $free( p$count\[0\] );\n    $free( p$count );\n";
 }
 
 # Add null to 2-dimensional arrays of input strings.  Used only 

-----------------------------------------------------------------------

Summary of changes:
 src/binding/fortran/mpif_h/buildiface |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list