resolve several issues found by cppcheck

[client/X11/xf_floatbar.c:800] -> [client/X11/xf_floatbar.c:796]: (warning) Either the condition '!floatbar' is redundant or there is possible null pointer dereference: floatbar.
[client/X11/xf_floatbar.c:800] -> [client/X11/xf_floatbar.c:797]: (warning) Either the condition '!floatbar' is redundant or there is possible null pointer dereference: floatbar.
[client/X11/xf_floatbar.c:800] -> [client/X11/xf_floatbar.c:798]: (warning) Either the condition '!floatbar' is redundant or there is possible null pointer dereference: floatbar.
[libfreerdp/codec/dsp.c:1156] -> [libfreerdp/codec/dsp.c:1154]: (warning) Either the condition '!srcFormat' is redundant or there is possible null pointer dereference: srcFormat.
[channels/drdynvc/client/drdynvc_main.c:1453] -> [channels/drdynvc/client/drdynvc_main.c:1450]: (warning) Either the condition '!drdynvc' is redundant or there is possible null pointer dereference: drdynvc.
[channels/audin/client/opensles/audin_opensl_es.c:98] -> [channels/audin/client/opensles/audin_opensl_es.c:94]: (warning) Either the condition '!opensles' is redundant or there is possible null pointer dereference: opensles.
[channels/audin/client/opensles/audin_opensl_es.c:159] -> [channels/audin/client/opensles/audin_opensl_es.c:153]: (warning) Either the condition '!opensles' is redundant or there is possible null pointer dereference: opensles.
This commit is contained in:
Ilya Shipitsin 2019-01-02 20:35:24 +05:00
parent 15fd55ded8
commit bdc039e719
4 changed files with 6 additions and 17 deletions

View File

@ -93,11 +93,6 @@ static UINT audin_opensles_free(IAudinDevice* device)
WLog_Print(opensles->log, WLOG_DEBUG, "device=%p", (void*) device);
/* The function may have been called out of order,
* ignore duplicate requests. */
if (!opensles)
return CHANNEL_RC_OK;
free(opensles->device_name);
free(opensles);
return CHANNEL_RC_OK;
@ -154,11 +149,6 @@ static UINT audin_opensles_set_format(IAudinDevice* device,
(void*) device, (void*) format, FramesPerPacket);
assert(format);
/* The function may have been called out of order, ignore
* requests before the device is available. */
if (!opensles)
return CHANNEL_RC_OK;
opensles->format = *format;
switch (format->wFormatTag)

View File

@ -1447,12 +1447,12 @@ static UINT drdynvc_virtual_channel_event_disconnected(drdynvcPlugin* drdynvc)
{
UINT status;
if (drdynvc->OpenHandle == 0)
return CHANNEL_RC_OK;
if (!drdynvc)
return CHANNEL_RC_BAD_CHANNEL_HANDLE;
if (drdynvc->OpenHandle == 0)
return CHANNEL_RC_OK;
if (!MessageQueue_PostQuit(drdynvc->queue, 0))
{
status = GetLastError();

View File

@ -797,9 +797,6 @@ void xf_floatbar_free(xfFloatbar* floatbar)
xfc = floatbar->xfc;
size = ARRAYSIZE(floatbar->buttons);
if (!floatbar)
return;
for (i = 0; i < size; i++)
{
xf_floatbar_button_free(xfc, floatbar->buttons[i]);

View File

@ -1151,11 +1151,13 @@ BOOL freerdp_dsp_encode(FREERDP_DSP_CONTEXT* context, const AUDIO_FORMAT* srcFor
#else
const BYTE* resampleData;
size_t resampleLength;
AUDIO_FORMAT format = *srcFormat;
AUDIO_FORMAT format;
if (!context || !context->encoder || !srcFormat || !data || !out)
return FALSE;
format = *srcFormat;
if (!freerdp_dsp_channel_mix(context, data, length, srcFormat, &resampleData, &resampleLength))
return FALSE;