summaryrefslogtreecommitdiff
path: root/libopie2
authorerik <erik>2007-01-24 19:46:19 (UTC)
committer erik <erik>2007-01-24 19:46:19 (UTC)
commita017bf21dd89159052f2f7a3fbc043a24956c08c (patch) (unidiff)
tree008be2b62ee5487dc55b8a7c7f043c94268f8362 /libopie2
parenta4a7bd22feb060a80e20c81cded43cc24f5cd423 (diff)
downloadopie-a017bf21dd89159052f2f7a3fbc043a24956c08c.zip
opie-a017bf21dd89159052f2f7a3fbc043a24956c08c.tar.gz
opie-a017bf21dd89159052f2f7a3fbc043a24956c08c.tar.bz2
Every file in this commit has a memory leak of some kind or another. I think
all of them are minor and should not effect properly running code. But if I were you I would give libstocks and the stockticker plugin in Today a wide berth. That library is atrocious.
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/oimageeffect.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/libopie2/opieui/oimageeffect.cpp b/libopie2/opieui/oimageeffect.cpp
index be47eb2..93719bc 100644
--- a/libopie2/opieui/oimageeffect.cpp
+++ b/libopie2/opieui/oimageeffect.cpp
@@ -2042,26 +2042,29 @@ void OImageEffect::normalize(QImage &img)
2042 for(low=0; low < MaxRGB; ++low){ 2042 for(low=0; low < MaxRGB; ++low){
2043 intense+=histogram[low]; 2043 intense+=histogram[low];
2044 if(intense > threshold_intensity) 2044 if(intense > threshold_intensity)
2045 break; 2045 break;
2046 } 2046 }
2047 intense=0; 2047 intense=0;
2048 for(high=MaxRGB; high != 0; --high) 2048 for(high=MaxRGB; high != 0; --high)
2049 { 2049 {
2050 intense+=histogram[high]; 2050 intense+=histogram[high];
2051 if(intense > threshold_intensity) 2051 if(intense > threshold_intensity)
2052 break; 2052 break;
2053 } 2053 }
2054 if(low == high) 2054 if(low == high) {
2055 free(histogram);
2056 free(normalize_map);
2055 return; // zero span bound 2057 return; // zero span bound
2058 }
2056 } 2059 }
2057 2060
2058 // Stretch the histogram to create the normalized image mapping. 2061 // Stretch the histogram to create the normalized image mapping.
2059 for(i=0; i <= MaxRGB; i++){ 2062 for(i=0; i <= MaxRGB; i++){
2060 if (i < (int) low) 2063 if (i < (int) low)
2061 normalize_map[i]=0; 2064 normalize_map[i]=0;
2062 else{ 2065 else{
2063 if(i > (int) high) 2066 if(i > (int) high)
2064 normalize_map[i]=MaxRGB; 2067 normalize_map[i]=MaxRGB;
2065 else 2068 else
2066 normalize_map[i]=(MaxRGB-1)*(i-low)/(high-low); 2069 normalize_map[i]=(MaxRGB-1)*(i-low)/(high-low);
2067 } 2070 }