Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset fc3d4fd5 in mainline


Ignore:
Timestamp:
2017-09-06T22:16:31Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
12dcd5f
Parents:
d14840d
Message:

Downloader should properly clean up HTTP connection.

Location:
uspace
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/download/main.c

    rd14840d rfc3d4fd5  
    7272        void *buf = NULL;
    7373        uri_t *uri = NULL;
     74        http_t *http = NULL;
    7475        int rc;
    7576
     
    182183        }
    183184       
    184         http_t *http = http_create(uri->host, port);
     185        http = http_create(uri->host, port);
    185186        if (http == NULL) {
    186187                fprintf(stderr, "Failed creating HTTP object\n");
     
    234235       
    235236        free(buf);
     237        http_destroy(http);
    236238        uri_destroy(uri);
    237239        if (fclose(ofile) != 0) {
     
    243245error:
    244246        free(buf);
     247        if (http != NULL)
     248                http_destroy(http);
    245249        if (uri != NULL)
    246250                uri_destroy(uri);
  • uspace/lib/http/src/http.c

    rd14840d rfc3d4fd5  
    121121       
    122122        tcp_conn_destroy(http->conn);
     123        http->conn = NULL;
    123124        tcp_destroy(http->tcp);
     125        http->tcp = NULL;
     126       
    124127        return EOK;
    125128}
     
    127130void http_destroy(http_t *http)
    128131{
     132        (void) http_close(http);
    129133        recv_buffer_fini(&http->recv_buffer);
    130134        free(http);
Note: See TracChangeset for help on using the changeset viewer.