From 19e0392db664485ce90efd8ca547b3acc8c61f33 Mon Sep 17 00:00:00 2001 From: jianf <2198972886@qq.com> Date: Mon, 2 Feb 2026 21:05:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=86=85=E5=AD=98=E4=B8=8D?= =?UTF-8?q?=E8=B6=B3=E6=97=B6=E7=9A=84=E6=97=A5=E5=BF=97=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E8=A1=8C=E4=B8=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- c/tools/log/log.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/c/tools/log/log.c b/c/tools/log/log.c index b271844..c3fc52c 100644 --- a/c/tools/log/log.c +++ b/c/tools/log/log.c @@ -182,11 +182,9 @@ int cleanup(log_manager *self) else{ write_into_block(logbuf,loc->log,&buf_length,MAX_LOG_LENGTH,"log.txt"); } - if(logbuf == failback&&buf_length>MAX_LOG_LENGTH) - logbuf[MAX_LOG_LENGTH-1] = '\0'; - else{ - logbuf[buf_length] = '\0'; - } + + logbuf[buf_length] = '\0'; + free(loc); fd = open("log.txt",O_CREAT | O_WRONLY | O_APPEND, 0644);