From 13434794ac5eb634237a212cf368c36bddaf9a92 Mon Sep 17 00:00:00 2001 From: dongwenze Date: Mon, 20 Feb 2023 18:54:41 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20=E4=BF=AE=E6=AD=A3=E5=88=A0=E9=99=A4DHCP?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E6=B1=A0=E5=8A=9F=E8=83=BD=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- srcs/opendhcp183/query.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/srcs/opendhcp183/query.cpp b/srcs/opendhcp183/query.cpp index 7abe8a0..d22e99a 100644 --- a/srcs/opendhcp183/query.cpp +++ b/srcs/opendhcp183/query.cpp @@ -594,7 +594,6 @@ static int delete_dhcpd_rangeset(data19 *req, const char *pRequest) { HASH_DEL(delMap, delRange); } else { - //Write dhcpRanges memcpy(&dhcpRanges[resCount], &cfig.dhcpRanges[i], sizeof(struct data13)); resCount++; } @@ -602,8 +601,7 @@ static int delete_dhcpd_rangeset(data19 *req, const char *pRequest) { //The input parameter does not exist if (resCount > cfig.rangeCount - cJSON_GetArraySize(pdhcp_range)) { - cJSON *pdel_Item = cJSON_CreateObject(); - auto *s = (PHASH_MAP)malloc(sizeof(HASH_MAP)); + auto *s = (PHASH_MAP)malloc(sizeof(HASH_MAP)); PHASH_MAP tmp; char saddr[128]; char eaddr[128]; @@ -611,6 +609,7 @@ static int delete_dhcpd_rangeset(data19 *req, const char *pRequest) { memset(del_range, 0, 256); HASH_ITER(hh, delMap, s, tmp) { + cJSON *pdel_Item = cJSON_CreateObject(); IP2String(saddr, ntohl(s->key)); IP2String(eaddr, ntohl(s->value)); @@ -635,7 +634,7 @@ static int delete_dhcpd_rangeset(data19 *req, const char *pRequest) { cfig.rangeCount = (char)resCount; const char *pStrPro = proto_create_new(pRspRoot, 200); - fp += sprintf(fp, "%s", pStrPro); + fp += sprintf(fp, "%s", pStrPro); cJSON_Delete(pRoot); req->bytes = (int)(fp - req->dp);