From d6d037beeb90d637a8da091177930fd789dd3c3c Mon Sep 17 00:00:00 2001 From: Ferràn Quer i Guerrero Date: Thu, 8 May 2014 09:42:51 +0000 Subject: [PATCH] --- Project/applications/smartcities/httpClient.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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; } -- libgit2 0.22.2