[sofia-sip] Fix memory leak when incomplete tls connection.
This commit is contained in:
parent
dd1aab3332
commit
0af811bb24
|
@ -1 +1 @@
|
||||||
Fri Sep 20 12:16:57 CDT 2019
|
Tue Oct 08 10:50:11 CDT 2019
|
||||||
|
|
|
@ -1056,15 +1056,19 @@ int tport_register_secondary(tport_t *self, su_wakeup_f wakeup, int events)
|
||||||
&&
|
&&
|
||||||
(i = su_root_register(root, wait, wakeup, self, 0)) != -1) {
|
(i = su_root_register(root, wait, wakeup, self, 0)) != -1) {
|
||||||
|
|
||||||
|
/* Can't be added to list of opened if already closed */
|
||||||
|
if (tport_is_closed(self)) goto fail;
|
||||||
|
|
||||||
self->tp_index = i;
|
self->tp_index = i;
|
||||||
self->tp_events = events;
|
self->tp_events = events;
|
||||||
|
|
||||||
/* Can't be added to list of opened if already closed */
|
tprb_append(&self->tp_pri->pri_open, self);
|
||||||
if (!tport_is_closed(self))
|
|
||||||
tprb_append(&self->tp_pri->pri_open, self);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fail:
|
||||||
|
SU_DEBUG_9(("%s(%p): tport is %s!\n", __func__, (void *)self, (tport_is_closed(self) ? "closed" : "opened")));
|
||||||
su_wait_destroy(wait);
|
su_wait_destroy(wait);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -969,12 +969,19 @@ int tls_connect(su_root_magic_t *magic, su_wait_t *w, tport_t *self)
|
||||||
if (events & SU_WAIT_HUP && !self->tp_closed)
|
if (events & SU_WAIT_HUP && !self->tp_closed)
|
||||||
tport_hup_event(self);
|
tport_hup_event(self);
|
||||||
|
|
||||||
if (self->tp_closed)
|
if (self->tp_closed) {
|
||||||
|
SU_DEBUG_9(("%s(%p): tport was closed during connect. Returning, but set secondary timer first.\n",
|
||||||
|
__func__, (void *)self));
|
||||||
|
tport_set_secondary_timer(self);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
error = su_soerror(self->tp_socket);
|
error = su_soerror(self->tp_socket);
|
||||||
if (error) {
|
if (error) {
|
||||||
tport_error_report(self, error, NULL);
|
tport_error_report(self, error, NULL);
|
||||||
|
SU_DEBUG_9(("%s(%p): socket error during connect. Returning, but set secondary timer first.\n",
|
||||||
|
__func__, (void *)self));
|
||||||
|
tport_set_secondary_timer(self);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue