From f3a1fe544e5efef3279106bd6d4c35d813a4d437 Mon Sep 17 00:00:00 2001 From: Maxim Date: Wed, 15 Apr 2015 14:08:51 +0300 Subject: [PATCH] fixed-check for calloc return memory --- channels/tsmf/client/tsmf_media.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/channels/tsmf/client/tsmf_media.c b/channels/tsmf/client/tsmf_media.c index 5d81bd0ba..82d86c65a 100644 --- a/channels/tsmf/client/tsmf_media.c +++ b/channels/tsmf/client/tsmf_media.c @@ -384,7 +384,13 @@ static void tsmf_sample_playback_video(TSMF_SAMPLE* sample) { event.numVisibleRects = presentation->nr_rects; event.visibleRects = (RECTANGLE_16*) calloc(1, event.numVisibleRects * sizeof(RECTANGLE_16)); - memcpy(event.visibleRects, presentation->rects, presentation->nr_rects * sizeof(RDP_RECT)); + if (event.visibleRects) + memcpy(event.visibleRects, presentation->rects, presentation->nr_rects * sizeof(RDP_RECT)); + else + { + presentation->nr_rects=0; + WLog_ERR(TAG, "can't allocate memory for copy rectangles"); + } } #if 0