Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

two possible memleaks in werkkzeug3 #13

Merged
merged 2 commits into from

2 participants

@png85

hi,
the commits in this pull request fix two posible memory leaks in the Bitmap_Blur() functions of genbitmap.cpp and w3texlib/genbitmap.cpp
the problem with the original files was that 'qq' was initialized to heap memory but never freed before returning from the function when 'order' is 0.
to counter this i've moved the allocation of the pointer below the problematic 'if' statement which should be reasonably safe since it didn't get used before anyways.

@rygorous rygorous merged commit 66f3243 into farbrausch:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 4 deletions.
  1. +3 −2 werkkzeug3/genbitmap.cpp
  2. +3 −2 werkkzeug3/w3texlib/genbitmap.cpp
View
5 werkkzeug3/genbitmap.cpp
@@ -1463,11 +1463,12 @@ GenBitmap * __stdcall Bitmap_Blur(GenBitmap *bm,sInt flags,sF32 sx,sF32 sy,sF32
// prepare
- pp = (sU16 *)bm->Data;
- qq = (sU16 *) new sU64[bm->Size];
order = flags & 15;
if(order==0) return bm;
+ pp = (sU16 *)bm->Data;
+ qq = (sU16 *) new sU64[bm->Size];
+
// blur x
size = sFtol(128*sx*bm->XSize);
View
5 werkkzeug3/w3texlib/genbitmap.cpp
@@ -1346,11 +1346,12 @@ GenBitmap * __stdcall Bitmap_Blur(GenBitmap *bm,sInt flags,sF32 sx,sF32 sy,sF32
// prepare
- pp = (sU16 *)bm->Data;
- qq = (sU16 *) new sU64[bm->Size];
order = flags & 15;
if(order==0) return bm;
+ pp = (sU16 *)bm->Data;
+ qq = (sU16 *) new sU64[bm->Size];
+
// blur x
size = sFtol(128*sx*bm->XSize);
Something went wrong with that request. Please try again.