Hi,

If there are multiple overlapping calls to keyboard_entry_redirect() made while 
one redirect request is in progress, it seems that memory for all callbacks 
except the most recent one is leaked.

sig_gui_entry_redirect() in fe-text/gui-readline.c will not handle the case 
where "redir" is already valid.

Worse, the old callbacks will never get called, which may break the state of 
anything depending on the callback being eventually called.  Furthermore there 
seems to be no mechanism to signal a failure from keyboard_entry_redirect(), 
thus the API interface is a bit broken as there's no simple way to handle this 
right now.

Individual irssi plugins can work around this by keeping track of their 
outstanding calls to keyboard_entry_redirect and making sure that there's never 
>1 overlapping call, but if another irssi plugin, or irssi itself, were to call 
keyboard_entry_redirect(), then this breaks down.

I ran into this while rewriting some of the keyboard prompt code for the silc 
plugin for irssi.  I am working around this by making sure the silc plugin 
never calls keyboard_entry_redirect in an overlapped fashion, but we are still 
a bit hosed if somebody else calls it while we have an outstanding request in 
flight.

This really needs to be addressed in the irssi core.

(This is based off of irssi 0.8.12.)

- S

Reply via email to