Fix json_object ref_count underflow in ipc_event_binding:1175.

json_object *str is added to the symbols array in line 1174.
json-c documentation states that the ref count is not incremented
by json_object_array_add so the ownership to str is lost.
Unfortunately str gets re-added to sb_obj in line 1184 and
leads to segfault when json_object_put is called in ipc_event_binding.
Either find a way to increment ref count or dup string as implemented
in this bugfix.
This commit is contained in:
Jae Jang 2018-04-06 19:53:11 -04:00
parent 8e06985cc1
commit a1e52566d8

View file

@ -1172,7 +1172,7 @@ void ipc_event_binding_keyboard(struct sway_binding *sb) {
json_object *str = json_object_new_string(buffer);
json_object_array_add(symbols, str);
if (i == 0) {
symbol = str;
symbol = json_object_new_string(buffer);
}
}
}