eloop: fix memory loop when signal registration fails

If the signal-registration fails, we need to destroy it again. Otherwise,
it will keep a reference to the current eloop-object and hence it will
never get freed.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-12-02 14:57:43 +01:00
parent 46898b1090
commit 57f85f91ce

View File

@ -2186,7 +2186,13 @@ int ev_eloop_register_signal_cb(struct ev_eloop *loop, int signum,
return ret;
}
return shl_hook_add_cast(sig->hook, cb, data);
ret = shl_hook_add_cast(sig->hook, cb, data);
if (ret) {
signal_free(sig);
return ret;
}
return 0;
}
/**