MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0023281Community[OCCT] OCCT:Visualizationpublic2012-07-13 19:012013-04-29 15:21
ReporterPawel 
Assigned ToPawel 
PrioritynormalSeverityminor 
StatusclosedResolutionfixed 
PlatformAOSLOS VersionL
Product Version[OCCT] 6.5.3 
Target Version[OCCT] 6.6.0Fixed in Version[OCCT] 6.6.0 
Summary0023281: Memory leak / verification of one variable ommitted in OpenGL_ImageBox.cxx
DescriptionIn the line 347 the variable 'abuf' is not checked against NULL.

In the next line, if the method returns any previously allocated memory is not freed. It is necessary to call delete on each of the verified variables (C++ makes it safe to call delete even on NULL-variables.) and to clean up using'ImageClose'.

TagsNo tags attached.
Test case numberNot needed
Attached Files

- Relationships

-  Notes
(0020977)
Pawel (developer)
2012-07-13 19:12

Corresponding git branch pushed. Please review.
(0020978)
kgv (developer)
2012-07-16 09:19

OpenGl_ImageBox.cxx,
> base = new unsigned[image->xsize*image->ysize];
> rbuf = new unsigned char[image->xsize];
> gbuf = new unsigned char[image->xsize];
> bbuf = new unsigned char[image->xsize];
> abuf = new unsigned char[image->xsize];
> if(!base || !rbuf || !gbuf || !bbuf || !abuf)
> {
> ImageClose(image);
> delete [] base;
> delete [] rbuf;
> delete [] gbuf;
> delete [] bbuf;
> delete [] abuf;
> return NULL;
> }
These NULL-checks are meaningless according to C++ rules.
Allocations should be performed with exception-free methods (malloc etc.) or these checks should be entirely removed.

Please also avoid tabulation symbols in patches.
(0020983)
Pawel (developer)
2012-07-16 12:57

Dear kgv,

as 'mallocs' were removed in one of the previous versions I left the 'new - delete' combination.

Exception handling instead of NULL-checks implemented.
Tabulations removed.

Corresponding git branch pushed/updated. Please review.
(0020984)
Pawel (developer)
2012-07-16 12:58

Please refer to the added note.
(0021100)
Pawel (developer)
2012-07-20 19:08

Dear kgv,

I'm not sure if you got the notification about the changes I've made (not sure if Mantis notified you) that's why I 'request feedback'.
(0021845)
kgv (developer)
2012-10-18 20:49

Dear san, please review the patch.

OpenGl_ImageBox seems to be unused in current TKOpenGl at all.
Updated patch is pushed to CR23281_2 branch.
(0021850)
san (developer)
2012-10-19 14:50

Branch СR23281_2 reviewed without remarks, ready for testing.

Dear kgv,

Could you please put some comment in this issue regarding removal of GetTexture*() functions from OpenGl_TextureBox.hxx/.cxx?
(0021863)
kgv (developer)
2012-10-19 19:59

>Could you please put some comment in this issue
>regarding removal of GetTexture*() functions from OpenGl_TextureBox.hxx/.cxx?
GetTexture() function implements reading of texture from file using read_texture from OpenGl_ImageBox. read_texture() read uncompressed data from file with some header - this is difficult to understand is this format is well-known or custom one due to lack of documentation.

Anyway this functionality is not used by OpenGl_GraphicDriver. Instead GetTextureData() is used which create texture from already read/decoded image.
(0022025)
apn (administrator)
2012-10-31 11:02

Dear BugMaster,
Branch СR23281_2 (and products from GIT master) was compiled on Linux and Windows platforms and tested.

Regression:
Not detected

Improvements:
Not detected

Testing case:
Not needed

- Related Changesets
occt: master 43c34303
Timestamp: 2012-10-18 16:44:39
Author: kgv
Committer: Pawel
Details ] Diff ]
0023281: Removed unused OpenGl_ImageBox
mod - src/Image/Image_Color.hxx Diff ] File ]
mod - src/OpenGl/FILES Diff ] File ]
rm - src/OpenGl/OpenGl_ImageBox.cxx Diff ] File ]
rm - src/OpenGl/OpenGl_ImageBox.hxx Diff ] File ]
mod - src/OpenGl/OpenGl_TextureBox.cxx Diff ] File ]
mod - src/OpenGl/OpenGl_TextureBox.hxx Diff ] File ]

- Issue History
Date Modified Username Field Change
2012-07-13 19:01 Pawel New Issue
2012-07-13 19:01 Pawel Assigned To => Pawel
2012-07-13 19:09 Pawel Description Updated View Revisions
2012-07-13 19:12 Pawel Note Added: 0020977
2012-07-13 19:12 Pawel Assigned To Pawel => bugmaster
2012-07-13 19:12 Pawel Status new => resolved
2012-07-16 09:19 kgv Note Added: 0020978
2012-07-16 09:19 kgv Assigned To bugmaster => Pawel
2012-07-16 09:19 kgv Status resolved => assigned
2012-07-16 12:57 Pawel Note Added: 0020983
2012-07-16 12:58 Pawel Note Added: 0020984
2012-07-16 12:58 Pawel Assigned To Pawel => kgv
2012-07-16 12:58 Pawel Status assigned => resolved
2012-07-20 19:08 Pawel Note Added: 0021100
2012-07-20 19:08 Pawel Status resolved => feedback
2012-10-18 20:49 kgv Note Added: 0021845
2012-10-18 20:49 kgv Assigned To kgv => san
2012-10-18 20:49 kgv Status feedback => resolved
2012-10-19 14:50 san Note Added: 0021850
2012-10-19 14:50 san Assigned To san => bugmaster
2012-10-19 14:50 san Status resolved => reviewed
2012-10-19 19:59 kgv Note Added: 0021863
2012-10-23 11:31 abv Target Version 6.5.4 => 6.6.0
2012-10-23 16:18 mkv Assigned To bugmaster => mkv
2012-10-31 11:02 apn Note Added: 0022025
2012-10-31 11:03 apn Test case number => Not needed
2012-10-31 11:03 apn Assigned To mkv => bugmaster
2012-10-31 11:03 apn Status reviewed => tested
2012-11-16 13:03 Pawel Changeset attached => occt master 43c34303
2012-11-16 13:03 Pawel Assigned To bugmaster => Pawel
2012-11-16 13:03 Pawel Status tested => verified
2012-11-16 13:03 Pawel Resolution open => fixed
2012-12-10 17:16 Pawel Changeset attached => occt master 43c34303
2013-04-23 13:36 user533 Status verified => closed
2013-04-29 15:21 user533 Fixed in Version => 6.6.0


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker