From a04f3f987613df8bdfa6c5adf7bf29b646110af5 Mon Sep 17 00:00:00 2001
From: "Dmitriy A. Gerasimov" <dmitriy.gerasimov@demlabs.net>
Date: Tue, 3 Nov 2020 15:01:48 +0700
Subject: [PATCH] [*] Fixed bug with NULL free

---
 CMakeLists.txt                       | 2 +-
 dap-sdk/net/client/dap_client_http.c | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2e4c57375c..2ac273dbb0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@ project(cellframe-sdk C)
 cmake_minimum_required(VERSION 2.8)
 
 set(CMAKE_C_STANDARD 11)
-set(CELLFRAME_SDK_NATIVE_VERSION "2.6-29")
+set(CELLFRAME_SDK_NATIVE_VERSION "2.6-30")
 add_definitions ("-DCELLFRAME_SDK_VERSION=\"${CELLFRAME_SDK_NATIVE_VERSION}\"")
 
 set(DAPSDK_MODULES "")
diff --git a/dap-sdk/net/client/dap_client_http.c b/dap-sdk/net/client/dap_client_http.c
index 444a10b456..413631f29d 100644
--- a/dap-sdk/net/client/dap_client_http.c
+++ b/dap-sdk/net/client/dap_client_http.c
@@ -418,9 +418,10 @@ static void s_http_connected(dap_events_socket_t * a_esocket)
             "\r\n",
             l_http_pvt->method, l_http_pvt->path, l_get_str ? l_get_str : "", l_http_pvt->uplink_addr, l_request_headers->str);
     // send data for POST request
-    if(!l_get_str)
+    if(l_get_str)
+        DAP_DELETE(l_get_str);
+    else if ( l_http_pvt->request_size)
         dap_events_socket_write_unsafe( a_esocket, l_http_pvt->request, l_http_pvt->request_size);
-    DAP_DELETE(l_get_str);
     dap_string_free(l_request_headers, true);
 
 }
-- 
GitLab