X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fhashtable%2Fhashtable.c;h=07210fa8161e63e41a6ea12c061812b27c94d1c8;hp=263df46839d37af58e2efe66770f5e1833c90f0f;hb=efa116c6f19ecdc344a82709e7d919703ec96c45;hpb=5d2e1e66a968d9e555f9b8b00d0589ebfaf3de32 diff --git a/src/common/hashtable/hashtable.c b/src/common/hashtable/hashtable.c index 263df4683..07210fa81 100644 --- a/src/common/hashtable/hashtable.c +++ b/src/common/hashtable/hashtable.c @@ -105,6 +105,7 @@ struct lttng_ht *lttng_ht_new(unsigned long size, int type) break; default: ERR("Unknown lttng hashtable type %d", type); + lttng_ht_destroy(ht); goto error; } @@ -184,7 +185,7 @@ void lttng_ht_node_free_ulong(struct lttng_ht_node_ulong *node) /* * Free lttng ht node uint64_t. */ -void lttng_ht_node_free_u64(struct lttng_ht_node_ulong *node) +void lttng_ht_node_free_u64(struct lttng_ht_node_u64 *node) { assert(node); free(node); @@ -219,6 +220,20 @@ void lttng_ht_add_unique_str(struct lttng_ht *ht, assert(node_ptr == &node->node); } +/* + * Add string node to hashtable. + */ +void lttng_ht_add_str(struct lttng_ht *ht, + struct lttng_ht_node_str *node) +{ + assert(ht); + assert(ht->ht); + assert(node); + + cds_lfht_add(ht->ht, ht->hash_fct(node->key, lttng_ht_seed), + &node->node); +} + /* * Add unsigned long node to hashtable. */