From 5fc41c0932af10415861ffb1960ce306e2359828 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BD=AF=E5=AE=89=E7=A7=91=E6=8A=80=EF=BC=88SoftSec-Tech?= =?UTF-8?q?=EF=BC=89?= Date: Mon, 27 Oct 2025 11:47:19 +0800 Subject: [PATCH] Implement memory allocation and update main function Added memory allocation functions and updated main logic. --- test.cpp | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/test.cpp b/test.cpp index f1266f1..b8ae38a 100644 --- a/test.cpp +++ b/test.cpp @@ -2,6 +2,21 @@ #include #include "big_data_int.h" +typedef unsigned long long size_t; +extern void *malloc(size_t); +int *alloc(unsigned count); + +void test44_1() { int *p = alloc(10); } // #nodefect#RESOURCE_LEAK + +int *alloc2(unsigned count) { + if (count >= 0) { + return (int *)malloc(count); + } + return 0; +} + +void MyFunc() { int *p = alloc2(10); } + int main() { cout<<"please input two numbers:"<