fixed - detect realloc failed and return if calloc failed
This commit is contained in:
parent
f3a1fe544e
commit
26c054d7a4
@ -384,13 +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));
|
||||
if (event.visibleRects)
|
||||
memcpy(event.visibleRects, presentation->rects, presentation->nr_rects * sizeof(RDP_RECT));
|
||||
else
|
||||
if (!event.visibleRects)
|
||||
{
|
||||
presentation->nr_rects=0;
|
||||
WLog_ERR(TAG, "can't allocate memory for copy rectangles");
|
||||
return;
|
||||
}
|
||||
memcpy(event.visibleRects, presentation->rects, presentation->nr_rects * sizeof(RDP_RECT));
|
||||
presentation->nr_rects=0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -861,12 +861,12 @@ void tsmf_presentation_set_geometry_info(TSMF_PRESENTATION* presentation,
|
||||
|
||||
tmp_rects = realloc(presentation->rects, sizeof(RDP_RECT) * num_rects);
|
||||
|
||||
if (!tmp_rects&&num_rects)
|
||||
return;
|
||||
|
||||
presentation->nr_rects = num_rects;
|
||||
presentation->rects = tmp_rects;
|
||||
|
||||
if (!tmp_rects)
|
||||
return;
|
||||
|
||||
CopyMemory(presentation->rects, rects, sizeof(RDP_RECT) * num_rects);
|
||||
|
||||
ArrayList_Lock(presentation->stream_list);
|
||||
|
Loading…
Reference in New Issue
Block a user