Check the return value of calloc 79/306279/1 accepted/tizen/unified/20240220.144635 accepted/tizen/unified/x/20240221.033418
authorcheoleun moon <chleun.moon@samsung.com>
Mon, 19 Feb 2024 11:04:42 +0000 (20:04 +0900)
committercheoleun moon <chleun.moon@samsung.com>
Mon, 19 Feb 2024 11:04:48 +0000 (20:04 +0900)
Change-Id: Ib4c76e2c577f4c0f43ca7a0e0d119a0b9fdf6773

tool/tool_run.cpp

index f003adf..4b95eaf 100755 (executable)
@@ -388,6 +388,10 @@ static int _send_message_from_file(vine_dp_h dp)
                return -1;
        }
        buf = (unsigned char *)calloc(sizeof(unsigned char), size);
+       if (buf == NULL) {
+               fclose(file);
+               return -1;
+       }
 
        fseek(file, 0, SEEK_SET);
        count = fread(buf, sizeof(unsigned char), size, file);