From 78c6e1b16cfb9218684925f9e588c50739ebfaaf Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Sun, 14 May 2017 00:22:54 -0400 Subject: [PATCH] lib/values.c: logging: log array size when out of bound MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- lib/values.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/values.c b/lib/values.c index c885412a7..600320bd0 100644 --- a/lib/values.c +++ b/lib/values.c @@ -1047,8 +1047,8 @@ struct bt_value *bt_value_array_get(const struct bt_value *array_obj, if (index >= typed_array_obj->garray->len) { BT_LOGW("Invalid parameter: index is out of bounds: " - "addr=%p, index=%" PRIu64, - array_obj, index); + "addr=%p, index=%" PRIu64 ", size=%u", + array_obj, index, typed_array_obj->garray->len); ret = NULL; goto end; } @@ -1196,8 +1196,8 @@ enum bt_value_status bt_value_array_set(struct bt_value *array_obj, if (index >= typed_array_obj->garray->len) { BT_LOGW("Invalid parameter: index is out of bounds: " - "addr=%p, index=%" PRIu64, - array_obj, index); + "addr=%p, index=%" PRIu64 ", size=%u", + array_obj, index, typed_array_obj->garray->len); ret = BT_VALUE_STATUS_INVAL; goto end; } @@ -1274,7 +1274,6 @@ struct bt_value *bt_value_map_get(const struct bt_value *map_obj, quark = g_quark_from_string(key); ret = g_hash_table_lookup(typed_map_obj->ght, GUINT_TO_POINTER(quark)); - if (ret) { bt_get(ret); } -- 2.34.1