diff options
author | David Hankins <dhankins@isc.org> | 2008-03-18 18:28:14 +0000 |
---|---|---|
committer | David Hankins <dhankins@isc.org> | 2008-03-18 18:28:14 +0000 |
commit | 4619c0a2fb805a27baaa48728a564f9870300b29 (patch) | |
tree | 7366084f7686797f0360bcca7c5336237ebc950d /omapip/connection.c | |
parent | 507fe25f11f51eed58fffc49bf252784ba851074 (diff) | |
download | isc-dhcp-4619c0a2fb805a27baaa48728a564f9870300b29.tar.gz |
- A memory leak when using omapi has been fixed. [ISC-Bugs #17560]
Diffstat (limited to 'omapip/connection.c')
-rw-r--r-- | omapip/connection.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/omapip/connection.c b/omapip/connection.c index 93509696..e0cb9177 100644 --- a/omapip/connection.c +++ b/omapip/connection.c @@ -498,6 +498,28 @@ isc_result_t omapi_disconnect (omapi_object_t *h, /* If whatever created us registered a signal handler, send it a disconnect signal. */ omapi_signal (h, "disconnect", h); + + /* Disconnect from protocol object, if any. */ + if (h->inner != NULL) { + if (h->inner->outer != NULL) { + omapi_object_dereference(&h->inner->outer, MDL); + } + omapi_object_dereference(&h->inner, MDL); + } + + /* XXX: the code to free buffers should be in the dereference + function, but there is no special-purpose function to + dereference connections, so these just get leaked */ + /* Free any buffers */ + if (c->inbufs != NULL) { + omapi_buffer_dereference(&c->inbufs, MDL); + } + c->in_bytes = 0; + if (c->outbufs != NULL) { + omapi_buffer_dereference(&c->outbufs, MDL); + } + c->out_bytes = 0; + return ISC_R_SUCCESS; } |