diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-06-13 19:15:01 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-06-13 19:15:01 +0200 |
commit | 5125997a8acf4461b063576ed36e22ec6dc3b3c3 (patch) | |
tree | ac251701cf0040bb62bcbc62beb5bd3146e1b192 /ospfclient | |
parent | *: Clean up call into inet_aton (diff) | |
download | frr-5125997a8acf4461b063576ed36e22ec6dc3b3c3.tar.xz frr-5125997a8acf4461b063576ed36e22ec6dc3b3c3.zip |
ospfclient: Free up leaked resources in error path
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'ospfclient')
-rw-r--r-- | ospfclient/ospf_apiclient.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ospfclient/ospf_apiclient.c b/ospfclient/ospf_apiclient.c index 0ebae087e..3f3b5511a 100644 --- a/ospfclient/ospf_apiclient.c +++ b/ospfclient/ospf_apiclient.c @@ -183,6 +183,7 @@ ospf_apiclient_connect (char *host, int syncport) fd1 = socket (AF_INET, SOCK_STREAM, 0); if (fd1 < 0) { + close (async_server_sock); fprintf (stderr, "ospf_apiclient_connect: creating sync socket failed\n"); return NULL; @@ -196,6 +197,7 @@ ospf_apiclient_connect (char *host, int syncport) { fprintf (stderr, "ospf_apiclient_connect: SO_REUSEADDR failed\n"); close (fd1); + close (async_server_sock); return NULL; } @@ -206,6 +208,7 @@ ospf_apiclient_connect (char *host, int syncport) { fprintf (stderr, "ospf_apiclient_connect: SO_REUSEPORT failed\n"); close (fd1); + close (async_server_sock); return NULL; } #endif /* SO_REUSEPORT */ @@ -227,6 +230,7 @@ ospf_apiclient_connect (char *host, int syncport) { fprintf (stderr, "ospf_apiclient_connect: bind sync socket failed\n"); close (fd1); + close (async_server_sock); return NULL; } @@ -260,6 +264,7 @@ ospf_apiclient_connect (char *host, int syncport) fprintf (stderr, "ospf_apiclient_connect: accept async failed\n"); close (async_server_sock); close (fd1); + close (fd2); return NULL; } |