- i_gsampf() (used to implement getsamples() for floating point samples)
authorTony Cook <tony@develop=help.com>
Sun, 5 Mar 2006 23:37:36 +0000 (23:37 +0000)
committerTony Cook <tony@develop=help.com>
Sun, 5 Mar 2006 23:37:36 +0000 (23:37 +0000)
  was leaking memory. (detected by valgrind)

Changes
Imager.xs

diff --git a/Changes b/Changes
index 061aca8377569b36ee5bbc6fe908bbdf7e8befad..59e720116dab8ea36742291cd303ef4f2159b2c8 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1382,11 +1382,13 @@ Revision history for Perl extension Imager.
   different error when it reads a file with a bad magic number.
   Update the test to handle the possible messages.
 - some jpeg.c logging calls didn't include parameters enough to match
-  the supplied format string.
+  the supplied format string. (detected by valgrind)
 - in some cases memory wasn't being freed during error handling when
-  reading jpeg images
+  reading jpeg images (detected by valgrind)
 - free the TIFF object correctly when reading a TIFF image and the 
-  page number is out of range.
+  page number is out of range. (detected by valgrind)
+- i_gsampf() (used to implement getsamples() for floating point samples)
+  was leaking memory. (detected by valgrind)
 
 =================================================================
 
index 015510e3e50c2c3a601aabfa8f2d972e56e11d45..b349641e278cbd747fe1f58b59fce610369bba93 100644 (file)
--- a/Imager.xs
+++ b/Imager.xs
@@ -3689,6 +3689,7 @@ i_gsampf(im, l, r, y, ...)
             chans[i] = SvIV(ST(i+4));
           data = mymalloc(sizeof(i_fsample_t) * (r-l) * chan_count);
           count = i_gsampf(im, l, r, y, data, chans, chan_count);
+          myfree(chans);
           if (GIMME_V == G_ARRAY) {
             EXTEND(SP, count);
             for (i = 0; i < count; ++i)
@@ -3698,6 +3699,7 @@ i_gsampf(im, l, r, y, ...)
             EXTEND(SP, 1);
             PUSHs(sv_2mortal(newSVpv((void *)data, count * sizeof(i_fsample_t))));
           }
+          myfree(data);
         }
         else {
           if (GIMME_V != G_ARRAY) {