Commit d6d037beeb90d637a8da091177930fd789dd3c3c
1 parent
edb4f1ad
--no commit message
Showing
1 changed file
with
10 additions
and
4 deletions
Project/applications/smartcities/httpClient.c
... | ... | @@ -103,9 +103,13 @@ int httpRequest(struct httpHeaders head, char* content, int content_size) |
103 | 103 | //neocon->recv_timeout = 5000; // for 5s |
104 | 104 | connection_ok = netconn_recv(neocon, &netBufs); |
105 | 105 | printf("res recv= %d\r\n",connection_ok); |
106 | - netbuf_delete(netBufs); | |
107 | - netconn_close(neocon); | |
108 | - netconn_delete(neocon); | |
106 | + | |
107 | + if(connection_ok !=0) | |
108 | + { | |
109 | + netbuf_delete(netBufs); | |
110 | + netconn_close(neocon); | |
111 | + netconn_delete(neocon); | |
112 | + } | |
109 | 113 | } |
110 | 114 | // Manage Response |
111 | 115 | 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) |
115 | 119 | int http_response = response2int(response); |
116 | 120 | |
117 | 121 | // alliberem Mandela i Willy |
118 | - | |
122 | + netbuf_delete(netBufs); | |
123 | + netconn_close(neocon); | |
124 | + netconn_delete(neocon); | |
119 | 125 | chHeapFree(response); |
120 | 126 | return http_response; |
121 | 127 | } | ... | ... |