From 32fec2621b0fbca4f71135bc5e532727c5508c00 Mon Sep 17 00:00:00 2001 From: dongwenze Date: Mon, 6 Mar 2023 16:34:07 +0800 Subject: [PATCH] =?UTF-8?q?OCT=201.=E4=BF=AE=E6=AD=A3=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=86=85=E5=AD=98=E6=B3=84=E6=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- srcs/opendhcp183/query.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/srcs/opendhcp183/query.cpp b/srcs/opendhcp183/query.cpp index 77c5c9f..f3cd660 100644 --- a/srcs/opendhcp183/query.cpp +++ b/srcs/opendhcp183/query.cpp @@ -798,8 +798,11 @@ void iptvCacheCb(void *UNUSED(pArg)) { // 新发现设备没有被上报过 if (!pTemp) { auto pCacheDev = (PIPTV_DEV_SET)malloc(sizeof(IPTV_DEV_SET)); + auto pRepDev = (PIPTV_DEV_SET)malloc(sizeof(IPTV_DEV_SET)); + memcpy(pCacheDev, pDev, sizeof(IPTV_DEV_SET)); - HASH_ADD_STR(report, iptvMAC, pCacheDev); + memcpy(pRepDev, pDev, sizeof(IPTV_DEV_SET)); + HASH_ADD_STR(report, iptvMAC, pRepDev); isReport = true; // 添加到缓存列表供后续查询 @@ -836,6 +839,11 @@ void iptvCacheCb(void *UNUSED(pArg)) { inet_http_post_async(pUrl, pStrPro, on_http_response_cb, (void *)pStrPro); } + HASH_ITER(hh, report, pDev, pTmp) { + HASH_DEL(report, pDev); + free(pDev); + } + uv_sleep(10); } while (true); }