From 4acb196103952a3c9292a215e78a0888445a90a9 Mon Sep 17 00:00:00 2001 From: "flamingo[bot]" <277372822+flamingo[bot]@users.noreply.github.com> Date: Mon, 12 Oct 2026 05:12:35 +0000 Subject: [PATCH] fix(MESHAGEN-007): 3 review findings in mac_tile.c --- meshcore/KVM/MacOS/mac_tile.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/meshcore/KVM/MacOS/mac_tile.c b/meshcore/KVM/MacOS/mac_tile.c index 87ad10699..0a762f7bc 100644 --- a/meshcore/KVM/MacOS/mac_tile.c +++ b/meshcore/KVM/MacOS/mac_tile.c @@ -1,3 +1,19 @@ +/* + * Copyright 2011-2021 Intel Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /* * mac_tile.c * @@ -67,7 +83,7 @@ int calc_opt_compr_send(int x, int y, int captureWidth, int captureHeight, void* { if (tilebuffer != NULL) free(tilebuffer); tilebuffersize = captureWidth * captureHeight * 3; - if ((tilebuffer = malloc(tilebuffersize)) == NULL) return 0; + if ((tilebuffer = malloc(tilebuffersize)) == NULL) { tilebuffersize = 0; return 0; } } //Get the final coalesced tile @@ -418,6 +434,7 @@ int getScreenBuffer(unsigned char **desktop, long long *desktopsize, CGImageRef if (*desktop != NULL) { free(*desktop); } *desktopsize = len; *desktop = (unsigned char *) malloc (*desktopsize); + if (*desktop == NULL) { *desktopsize = 0; CFRelease(dataRef); return -1; } } output = *desktop; @@ -544,3 +561,4 @@ void set_tile_compression(int type, int level) // TODO Make sure the all the types are handled. We ignore the type variable for now. } +