before:
CMMPacket* packet = new CMMPacket(MMP_PREVIEWANS); if (imgFrames != NULL && nCount != 0){ packet->WriteByte(MMT_OK); CxImage* cur_frame = imgFrames[0]; if (cur_frame == NULL){ ASSERT ( false ); return; } BYTE* abyResultBuffer = NULL; long nResultSize = 0; if (!cur_frame->Encode(abyResultBuffer, nResultSize, CXIMAGE_FORMAT_PNG)){ ASSERT ( false ); return; } packet->WriteInt(nResultSize); packet->m_pBuffer->Write(abyResultBuffer, nResultSize); free(abyResultBuffer); }
after:
CMMPacket* packet = new CMMPacket(MMP_PREVIEWANS); if (imgFrames != NULL && nCount != 0){ packet->WriteByte(MMT_OK); CxImage* cur_frame = imgFrames[0]; if (cur_frame == NULL){ ASSERT ( false ); delete packet; // FIXED HERE!!! return; } BYTE* abyResultBuffer = NULL; long nResultSize = 0; if (!cur_frame->Encode(abyResultBuffer, nResultSize, CXIMAGE_FORMAT_PNG)){ ASSERT ( false ); delete packet; // FIXED HERE!!! return; } packet->WriteInt(nResultSize); packet->m_pBuffer->Write(abyResultBuffer, nResultSize); free(abyResultBuffer); }
This post has been edited by gureedo: 04 February 2010 - 05:14 AM