diff --git a/srcs/libs/protocol/protocol.c b/srcs/libs/protocol/protocol.c
index 9ab740f..f8a3d24 100644
--- a/srcs/libs/protocol/protocol.c
+++ b/srcs/libs/protocol/protocol.c
@@ -36,7 +36,7 @@ const char *proto_decode_context(const char *pString, unsigned int *pVer, unsign
     cJSON *pCrypto = cJSON_GetObjectItem(pRoot, "cryptoType");
 
     if (!pCrypto) {
-        cJSON_free(pRoot);
+        cJSON_Delete(pRoot);
         return NULL;
     }
 
@@ -59,13 +59,13 @@ const char *proto_decode_context(const char *pString, unsigned int *pVer, unsign
     pMsgCtx = cJSON_GetObjectItem(pRoot, "msgContent");
 
     if (!pMsgCtx) {
-        cJSON_free(pRoot);
+        cJSON_Delete(pRoot);
         return NULL;
     }
 
     switch (pCrypto->valueint) {
         case CRYPTO_NONE:
-            pMsgContent = strdup(cJSON_Print(pMsgCtx));
+            pMsgContent = cJSON_Print(pMsgCtx);
             break;
         case CRYPTO_BASE64:
             pMsgContent = (char *)base64_decode(pMsgCtx->valuestring, (unsigned int *)&outSize);
@@ -83,7 +83,7 @@ const char *proto_decode_context(const char *pString, unsigned int *pVer, unsign
             } else if (pCrypto->valueint == CRYPTO_3DES) {
                 cryptoType = DES3_ECB_PKCS7PADDING;
             } else {
-                cJSON_free(pRoot);
+                cJSON_Delete(pRoot);
                 return NULL;
             }
 
@@ -95,7 +95,7 @@ const char *proto_decode_context(const char *pString, unsigned int *pVer, unsign
                 if (pMsgContent) {
                     free(pMsgContent);
                 }
-                cJSON_free(pRoot);
+                cJSON_Delete(pRoot);
                 return NULL;
             } else {
                 pMsgContent[decodeSize] = 0;
@@ -104,7 +104,7 @@ const char *proto_decode_context(const char *pString, unsigned int *pVer, unsign
         } break;
     }
 
-    cJSON_free(pRoot);
+    cJSON_Delete(pRoot);
     return pMsgContent;
 }
 
@@ -200,7 +200,7 @@ const char *proto_create_new(cJSON *pMsgCtx, int httpCode) {
             return NULL;
     }
 
-    pStrProto = cJSON_Print(pRoot);
+    pStrProto = cJSON_PrintUnformatted(pRoot);
     LOG_MOD(debug, ZLOG_MOD_PROTO, "Create: \n%s\n", pStrProto);
 
     cJSON_Delete(pRoot);