Changeset 784


Ignore:
Timestamp:
12/30/2010 12:35:42 PM (10 years ago)
Author:
dave
Message:

fixed memory leak
M magicsquares/src/Image.cpp

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libs/magicsquares/src/Image.cpp

    r665 r784  
    200200        IplImage *newimage = cvCreateImage(cvGetSize(m_Image), 8, 3); 
    201201    cvCvtColor(m_Image, newimage, CV_GRAY2RGB); 
    202         return Image(newimage); 
     202        Image ret(newimage); 
     203    cvReleaseImage(&newimage); 
     204    return ret; 
    203205} 
    204206 
     
    207209        IplImage *newimage = cvCreateImage(cvGetSize(m_Image), 8, 1); 
    208210    cvCvtColor(m_Image, newimage, CV_RGB2GRAY); 
    209         return Image(newimage); 
     211        Image ret(newimage); 
     212    cvReleaseImage(&newimage); 
     213    return ret; 
    210214} 
    211215 
     
    214218        IplImage *newimage = cvCreateImage(cvGetSize(m_Image), 8, 3); 
    215219    cvCvtColor(m_Image, newimage, CV_BayerGB2RGB); 
    216         return Image(newimage); 
     220        Image ret(newimage); 
     221    cvReleaseImage(&newimage); 
     222    return ret; 
    217223} 
    218224 
     
    221227        IplImage *newimage = cvCreateImage(cvSize(w,h), m_Image->depth, m_Image->nChannels); 
    222228        cvResize( m_Image, newimage, CV_INTER_LINEAR ); 
    223         return Image(newimage); 
     229        Image ret(newimage); 
     230    cvReleaseImage(&newimage); 
     231    return ret; 
    224232} 
    225233 
Note: See TracChangeset for help on using the changeset viewer.