Add error handling in keytable.c

Fix memory allocation in rtr_undo_update_key_table