The segmentation fault occurs because the 'session->out_buffer' is freed before the channels are freed. This buffer is used during 'ssh_channel_do_free' to send the EOF packet (I think). Moving the channel delete loop to a point before the line where 'session->out_buffer' is freed fixed the issue.
Should this be logged as a bug?