Changeset 6168

Show
Ignore:
Timestamp:
05/16/10 13:23:55 (3 years ago)
Author:
Cyrus
Message:

ustream: Fix possible fd leaking

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • luci2/libustream/protocol/http.c

    r6160 r6168  
    152152        if (!http->ssl) { 
    153153            if (!(http->ssl = ustream_tls_new(http->socket))) { 
     154                close(http->socket); 
    154155                goto error; 
    155156            } 
     
    166167        } 
    167168    } else { 
    168         int s = dup(http->socket); 
    169         if (!(http->transport = fdopen(s, "r+"))) { 
    170             close(s); 
     169        if (!(http->transport = fdopen(http->socket, "r+"))) { 
     170            close(http->socket); 
    171171            goto error; 
    172172        } 
     
    578578    } 
    579579    if (http->ssl) { 
     580        close(http->socket); 
    580581        SSL_shutdown(http->ssl); 
    581582        SSL_free(http->ssl); 
    582     } 
    583     if (http->socket) { 
    584         close(http->socket); 
    585583    } 
    586584    free(http);