Skip to content

Commit 0c6d3b9

Browse files
committed
fix duplicate KVP search in function rte_attach_tag()
1 parent c08c648 commit 0c6d3b9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/compat/relation_tags.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,16 @@ rte_attach_tag(const uint32 query_id,
9595
if (found)
9696
{
9797
const char *current_key;
98+
List *existing_kvp;
9899

99100
/* Extract key of this KVP */
100101
rte_deconstruct_tag(key_value_pair, &current_key, NULL);
101102

102103
/* Check if this KVP already exists */
103-
return relation_tags_search(htab_entry->relation_tags, current_key);
104+
existing_kvp = relation_tags_search(htab_entry->relation_tags,
105+
current_key);
106+
if (existing_kvp)
107+
return existing_kvp; /* return KVP with duplicate key */
104108
}
105109

106110
/* Don't forget to initialize list! */

0 commit comments

Comments
 (0)