Permalink
Browse files

Backport r24581 from trunk.

Fix a couple of memory leaks in MythZoneMinder.

git-svn-id: http://svn.mythtv.org/svn/branches/release-0-23-fixes@25064 7dbf422c-18fa-0310-86e9-fd20926502f2
  • Loading branch information...
1 parent cff982b commit 46ada0ce94f3a9e12a02e34bf735c2d96cebbb69 Paul Harrison committed Jun 9, 2010
Showing with 12 additions and 6 deletions.
  1. +12 −6 mythplugins/mythzoneminder/mythzoneminder/zmclient.cpp
@@ -521,6 +521,7 @@ void ZMClient::getEventFrame(int monitorID, int eventID, int frameNo, MythImage
if (!readData(data, imageSize))
{
VERBOSE(VB_GENERAL, "ZMClient::getEventFrame(): Failed to get image data");
+ delete [] data;
return;
}
@@ -532,8 +533,9 @@ void ZMClient::getEventFrame(int monitorID, int eventID, int frameNo, MythImage
if (!(*image)->loadFromData(data, imageSize, "JPEG"))
{
VERBOSE(VB_GENERAL, "ZMClient::getEventFrame(): Failed to load image from data");
- return;
}
+
+ delete [] data;
}
void ZMClient::getAnalyseFrame(int monitorID, int eventID, int frameNo, QImage &image)
@@ -558,13 +560,17 @@ void ZMClient::getAnalyseFrame(int monitorID, int eventID, int frameNo, QImage &
VERBOSE(VB_GENERAL, "ZMClient::getAnalyseFrame(): Failed to get image data");
image = QImage();
}
-
- // extract the image data and create a QImage from it
- if (!image.loadFromData(data, imageSize, "JPEG"))
+ else
{
- VERBOSE(VB_GENERAL, "ZMClient::getAnalyseFrame(): Failed to load image from data");
- image = QImage();
+ // extract the image data and create a QImage from it
+ if (!image.loadFromData(data, imageSize, "JPEG"))
+ {
+ VERBOSE(VB_GENERAL, "ZMClient::getAnalyseFrame(): Failed to load image from data");
+ image = QImage();
+ }
}
+
+ delete [] data;
}
int ZMClient::getLiveFrame(int monitorID, QString &status, unsigned char* buffer, int bufferSize)

0 comments on commit 46ada0c

Please sign in to comment.