Merge pull request #2261 from akallabeth/more_memleak_fixes

More warning and memleak fixes
This commit is contained in:
Marc-André Moreau 2014-12-11 08:28:48 -05:00
commit b579ad3cec
7 changed files with 19 additions and 11 deletions

View File

@ -522,8 +522,10 @@ int cliprdr_client_format_list(CliprdrClientContext* context, CLIPRDR_FORMAT_LIS
if (formatNameSize > 15) if (formatNameSize > 15)
formatNameSize = 15; formatNameSize = 15;
Stream_Write(s, wszFormatName, formatNameSize * 2); if (wszFormatName)
Stream_Write(s, wszFormatName, formatNameSize * 2);
Stream_Zero(s, 32 - (formatNameSize * 2)); Stream_Zero(s, 32 - (formatNameSize * 2));
free(wszFormatName); free(wszFormatName);

View File

@ -57,6 +57,9 @@ int rdpgfx_read_h264_metablock(RDPGFX_PLUGIN* gfx, wStream* s, RDPGFX_H264_METAB
RDPGFX_RECT16* regionRect; RDPGFX_RECT16* regionRect;
RDPGFX_H264_QUANT_QUALITY* quantQualityVal; RDPGFX_H264_QUANT_QUALITY* quantQualityVal;
meta->regionRects = NULL;
meta->quantQualityVals = NULL;
if (Stream_GetRemainingLength(s) < 4) if (Stream_GetRemainingLength(s) < 4)
return -1; return -1;

View File

@ -963,6 +963,7 @@ static int xf_cliprdr_server_format_data_response(CliprdrClientContext* context,
} }
pDstData = NULL; pDstData = NULL;
DstSize = 0;
formatId = 0; formatId = 0;
altFormatId = 0; altFormatId = 0;

View File

@ -996,10 +996,10 @@ BYTE* freerdp_bitmap_planar_delta_encode_plane(BYTE* inPlane, int width, int hei
int freerdp_bitmap_planar_delta_encode_planes(BYTE* inPlanes[4], int width, int height, BYTE* outPlanes[4]) int freerdp_bitmap_planar_delta_encode_planes(BYTE* inPlanes[4], int width, int height, BYTE* outPlanes[4])
{ {
freerdp_bitmap_planar_delta_encode_plane(inPlanes[0], width, height, outPlanes[0]); outPlanes[0] = freerdp_bitmap_planar_delta_encode_plane(inPlanes[0], width, height, outPlanes[0]);
freerdp_bitmap_planar_delta_encode_plane(inPlanes[1], width, height, outPlanes[1]); outPlanes[1] = freerdp_bitmap_planar_delta_encode_plane(inPlanes[1], width, height, outPlanes[1]);
freerdp_bitmap_planar_delta_encode_plane(inPlanes[2], width, height, outPlanes[2]); outPlanes[2] = freerdp_bitmap_planar_delta_encode_plane(inPlanes[2], width, height, outPlanes[2]);
freerdp_bitmap_planar_delta_encode_plane(inPlanes[3], width, height, outPlanes[3]); outPlanes[3] = freerdp_bitmap_planar_delta_encode_plane(inPlanes[3], width, height, outPlanes[3]);
return 0; return 0;
} }

View File

@ -93,11 +93,11 @@ int shadow_subsystem_load_entry_points(RDP_SHADOW_ENTRY_POINTS* pEntryPoints, co
entry = shadow_subsystem_load_static_entry(name); entry = shadow_subsystem_load_static_entry(name);
ZeroMemory(pEntryPoints, sizeof(RDP_SHADOW_ENTRY_POINTS));
if (!entry) if (!entry)
return -1; return -1;
ZeroMemory(pEntryPoints, sizeof(RDP_SHADOW_ENTRY_POINTS));
if (entry(pEntryPoints) < 0) if (entry(pEntryPoints) < 0)
return -1; return -1;

View File

@ -177,7 +177,8 @@ char* FindApplicationPath(char* application)
return filename; return filename;
} }
HANDLE CreateProcessHandle(pid_t pid); static HANDLE CreateProcessHandle(pid_t pid);
static BOOL ProcessHandleCloseHandle(HANDLE handle);
BOOL _CreateProcessExA(HANDLE hToken, DWORD dwLogonFlags, BOOL _CreateProcessExA(HANDLE hToken, DWORD dwLogonFlags,
LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes,
@ -291,6 +292,7 @@ BOOL _CreateProcessExA(HANDLE hToken, DWORD dwLogonFlags,
if (!thread) if (!thread)
{ {
ProcessHandleCloseHandle(process);
goto finish; goto finish;
} }
@ -456,7 +458,7 @@ BOOL TerminateProcess(HANDLE hProcess, UINT uExitCode)
} }
static BOOL ProcessHandleCloseHandle(HANDLE handle) BOOL ProcessHandleCloseHandle(HANDLE handle)
{ {
WINPR_PROCESS* process = (WINPR_PROCESS*) handle; WINPR_PROCESS* process = (WINPR_PROCESS*) handle;
free(process); free(process);

View File

@ -109,7 +109,7 @@ int WLog_CallbackAppender_WriteImageMessage(wLog* log, wLogCallbackAppender* app
int WLog_CallbackAppender_WritePacketMessage(wLog* log, wLogCallbackAppender* appender, wLogMessage* message) int WLog_CallbackAppender_WritePacketMessage(wLog* log, wLogCallbackAppender* appender, wLogMessage* message)
{ {
if (!appender->package) if (appender->package)
{ {
appender->package(message); appender->package(message);
} }