From bff1b65f42f0a2ec3d49f18ad7237d8fe90615a7 Mon Sep 17 00:00:00 2001 From: hcj_ <1224667075@qq.com> Date: Fri, 17 May 2024 07:57:20 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E6=94=B9=E8=AF=BB=E5=8F=96=E9=80=9A?= =?utf8?q?=E8=AE=AF=E5=BD=95=E6=97=B6=E7=9A=84=E5=BC=82=E5=B8=B8=E5=88=A4?= =?utf8?q?=E6=96=AD(2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../fd230app/nativeui/phone/src/phoneaddressmodel.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/phoneaddressmodel.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/phoneaddressmodel.cpp index 39d49f1a2..67f0af0f2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/phoneaddressmodel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/phoneaddressmodel.cpp @@ -172,6 +172,13 @@ namespace OHOS char* buf = (char *)malloc(512); int ret=fread(buf,1,512,fp); + if(ret==0) + { + printf("文件为空\r\n"); + free(buf); + return; + } + int offset_f=512; while (ret==512) { @@ -186,6 +193,7 @@ namespace OHOS num=0; addressbook_t.num=0; printf("异常全部清除\r\n"); + free(buf); return; } printf("人数: %d\r\n",num); -- 2.17.1