diff --git a/Project/applications/smartcities/httpClient.c b/Project/applications/smartcities/httpClient.c index 670fe6e..e139ac6 100644 --- a/Project/applications/smartcities/httpClient.c +++ b/Project/applications/smartcities/httpClient.c @@ -103,9 +103,13 @@ int httpRequest(struct httpHeaders head, char* content, int content_size) //neocon->recv_timeout = 5000; // for 5s connection_ok = netconn_recv(neocon, &netBufs); printf("res recv= %d\r\n",connection_ok); - netbuf_delete(netBufs); - netconn_close(neocon); - netconn_delete(neocon); + + if(connection_ok !=0) + { + netbuf_delete(netBufs); + netconn_close(neocon); + netconn_delete(neocon); + } } // Manage Response printf("httpRequest: Response received. Let's parse the information\r\n"); @@ -115,7 +119,9 @@ int httpRequest(struct httpHeaders head, char* content, int content_size) int http_response = response2int(response); // alliberem Mandela i Willy - + netbuf_delete(netBufs); + netconn_close(neocon); + netconn_delete(neocon); chHeapFree(response); return http_response; }