diff options
author | Jorge Arellano Cid <jcid@dillo.org> | 2009-11-10 17:42:41 -0300 |
---|---|---|
committer | Jorge Arellano Cid <jcid@dillo.org> | 2009-11-10 17:42:41 -0300 |
commit | a39453a02f230683c480d7643b1ecfcd3a5ad7a2 (patch) | |
tree | afda5cebc26f780b77ebe52869f89e321a93267d /src/IO/dpi.c | |
parent | 67cab0ec64e4b66793675f8e83c4820c5dbd9be3 (diff) |
Fixed a couple file descriptor leaks in dillo's DPI code
Diffstat (limited to 'src/IO/dpi.c')
-rw-r--r-- | src/IO/dpi.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/IO/dpi.c b/src/IO/dpi.c index 5834ab0f..6491ea27 100644 --- a/src/IO/dpi.c +++ b/src/IO/dpi.c @@ -389,6 +389,7 @@ static int Dpi_start_dpid(void) } else { ret = 0; } + Dpi_close_fd(st_pipe[0]); } return ret; @@ -416,6 +417,8 @@ static int Dpi_read_comm_keys(int *port) SharedKey[i] = 0; ret = 1; } + if (In) + fclose(In); dFree(rcline); dFree(fname); @@ -525,12 +528,10 @@ static int Dpi_blocking_start_dpid(void) * change at any time, we'll ask each time. If someday we find * that connecting each time significantly degrades performance, * an optimized approach can be tried. - * TODO: here we should use the credentials in ~/.dillo/dpid_comm_keys - * (dpid port and password). */ static int Dpi_get_server_port(const char *server_name) { - int sock_fd, dpi_port = -1; + int sock_fd = -1, dpi_port = -1; int dpid_port, ok = 0; struct sockaddr_in sin; char *cmd, *request, *rply = NULL, *port_str; @@ -570,7 +571,6 @@ static int Dpi_get_server_port(const char *server_name) ok = 1; } dFree(request); - shutdown(sock_fd, 1); /* signals no more writes to dpid */ } if (ok) { /* Get the reply */ @@ -580,7 +580,6 @@ static int Dpi_get_server_port(const char *server_name) } else { ok = 1; } - Dpi_close_fd(sock_fd); } if (ok) { /* Parse reply */ @@ -597,6 +596,7 @@ static int Dpi_get_server_port(const char *server_name) dFree(cmd); } dFree(rply); + Dpi_close_fd(sock_fd); return ok ? dpi_port : -1; } |