From 5add39f46c8323875fb56bc764a8ff627ad82f18 Mon Sep 17 00:00:00 2001
From: Fu Juntang <StrongTiger_001@163.com>
Date: 星期五, 08 十月 2021 11:12:06 +0800
Subject: [PATCH] Adjust the free action independent of the return value from the function return.

---
 src/socket/bus_server_socket.cpp |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/socket/bus_server_socket.cpp b/src/socket/bus_server_socket.cpp
index 2d552da..315c356 100644
--- a/src/socket/bus_server_socket.cpp
+++ b/src/socket/bus_server_socket.cpp
@@ -462,6 +462,7 @@
 
 void BusServerSocket::_proxy_reg(const char *topic, size_t topic_size, const char *buf, size_t buf_size, int key, int flag)
 {
+  char data_buf[MAX_STR_LEN] = { 0x00 };
   char buf_temp[MAX_STR_LEN * MAX_TOPICS_NUN] = { 0x00 };
   int count = 0;
   int i = 0;
@@ -704,9 +705,9 @@
       count = 0;
     }
 
-    memset(buf_temp, 0x00, sizeof(buf_temp));
-    sprintf(buf_temp, "%d", count);
-    shm_sendto(shm_socket, buf_temp, strlen(buf_temp), key, &timeout, BUS_TIMEOUT_FLAG);
+    memset(data_buf, 0x00, sizeof(data_buf));
+    sprintf(data_buf, "%d", count);
+    shm_sendto(shm_socket, data_buf, strlen(data_buf), key, &timeout, BUS_TIMEOUT_FLAG);
 
   } else {
 

--
Gitblit v1.8.0