From 06edf5f7c58c272cddfcf545321b0cf06faf79ca Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Wed, 31 May 2017 14:32:59 +0500 Subject: [PATCH] resolve an issue found by cppcheck: [channels/tsmf/client/tsmf_main.c:89] -> [channels/tsmf/client/tsmf_main.c:95]: (warning) Either the condition '!callback' is redundant or there is possible null pointer dereference: callback. --- channels/tsmf/client/tsmf_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/channels/tsmf/client/tsmf_main.c b/channels/tsmf/client/tsmf_main.c index 338543e9a..259eb553e 100644 --- a/channels/tsmf/client/tsmf_main.c +++ b/channels/tsmf/client/tsmf_main.c @@ -79,6 +79,9 @@ BOOL tsmf_playback_ack(IWTSVirtualChannelCallback *pChannelCallback, int status = -1; TSMF_CHANNEL_CALLBACK *callback = (TSMF_CHANNEL_CALLBACK *) pChannelCallback; + if (!callback) + return FALSE; + s = Stream_New(NULL, 32); if (!s) return FALSE; @@ -92,7 +95,7 @@ BOOL tsmf_playback_ack(IWTSVirtualChannelCallback *pChannelCallback, DEBUG_TSMF("ACK response size %"PRIuz"", Stream_GetPosition(s)); - if (!callback || !callback->channel || !callback->channel->Write) + if (!callback->channel || !callback->channel->Write) { WLog_ERR(TAG, "callback=%p, channel=%p, write=%p", callback, (callback ? callback->channel : NULL),