title: OpenCV: cvCloneImage and memory leak
body: <p>I am very new to OpenCV. I noticed the following code has a memory leak:</p>
  
  <pre><code>IplImage *img, *img_dest;
  img = cvLoadImage("..\\..\\Sunset.jpg", CV_LOAD_IMAGE_COLOR);
  while(1) // to make the mem leak obvious
  {
      img_dest = cvCreateImage(cvGetSize(img), IPL_DEPTH_8U, 3);
      img_dest = cvCloneImage(img);
      cvReleaseImage( &amp;img_dest );
  }
  cvReleaseImage( &amp;img );
  </code></pre>
  
  <p>How to release the unreferenced data then? And is there an easy way to make a clean copy of an IPL image (of course we could write a loop to copy each element of the data...).</p>