Hi,

I have a piece of code to display images one after the other. I noticed a memory leak when I "play" 100 images or so.

Here is the code
Qt Code:
  1. QImage image = QImage(width, height, QImage::Format_RGB32);
  2. uint * scanLine;
  3. for (int i = 0; i < height; i++)
  4. {
  5. scanLine = (uint *) image.scanLine(i);
  6. for (int j = 0; j < width; j++)
  7. {
  8. pixel = 0xff - c[i * width + j];
  9. scanLine[j] =qRgb(pixel, pixel, pixel); //memory leak here
  10. }
  11. }
  12. delete [] c;
To copy to clipboard, switch view to plain text mode 

The image is displayed correctly but I cannot figure out what I am doing wrong here and why there is a memory leak.
height and width are 3000. c[] is a table of char with the image values. The image is a greyscale.

Can anyone help me solving this memory leak?

Cheers,
Arnaud