View Issue Details

IDProjectCategoryView StatusLast Update
0023281CommunityOCCT:Visualizationpublic2013-04-29 15:21
ReporterPawel Assigned ToPawel  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
PlatformAOSL 
Product Version6.5.3 
Target Version6.6.0Fixed in Version6.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

Activities

Pawel

2012-07-13 19:12

developer   ~0020977

Corresponding git branch pushed. Please review.

kgv

2012-07-16 09:19

developer   ~0020978

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.

Pawel

2012-07-16 12:57

developer   ~0020983

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.

Pawel

2012-07-16 12:58

developer   ~0020984

Please refer to the added note.

Pawel

2012-07-20 19:08

developer   ~0021100

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'.

kgv

2012-10-18 20:49

developer   ~0021845

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.

san

2012-10-19 14:50

developer   ~0021850

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?

kgv

2012-10-19 19:59

developer   ~0021863

>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.

apn

2012-10-31 11:02

administrator   ~0022025

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

2012-10-18 16:44:39

kgv


Committer: Pawel Details Diff
0023281: Removed unused OpenGl_ImageBox Affected Issues
0023281
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
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 aiv Status verified => closed
2013-04-29 15:21 aiv Fixed in Version => 6.6.0
The file specified in $g_log_destination "/var/log/mantis/bugs/LDAP.log" is not writable.