ircd: Fix capability entry name string ownership.
The entry->cap must be copied and exclusive to the entry for the cap to be orphaned, even if literals are expected. Because modules.
This commit is contained in:
parent
2e29fd422d
commit
94afbe9c8e
1 changed files with 4 additions and 2 deletions
|
@ -71,7 +71,7 @@ capability_put(struct CapabilityIndex *idx, const char *cap, void *ownerdata)
|
||||||
}
|
}
|
||||||
|
|
||||||
entry = rb_malloc(sizeof(struct CapabilityEntry));
|
entry = rb_malloc(sizeof(struct CapabilityEntry));
|
||||||
entry->cap = cap;
|
entry->cap = rb_strdup(cap);
|
||||||
entry->flags = 0;
|
entry->flags = 0;
|
||||||
entry->value = idx->highest_bit;
|
entry->value = idx->highest_bit;
|
||||||
entry->ownerdata = ownerdata;
|
entry->ownerdata = ownerdata;
|
||||||
|
@ -133,7 +133,9 @@ capability_destroy(rb_dictionary_element *delem, void *privdata)
|
||||||
{
|
{
|
||||||
s_assert(delem != NULL);
|
s_assert(delem != NULL);
|
||||||
|
|
||||||
rb_free(delem->data);
|
struct CapabilityEntry *entry = delem->data;
|
||||||
|
rb_free((char *)entry->cap);
|
||||||
|
rb_free(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CapabilityIndex *
|
struct CapabilityIndex *
|
||||||
|
|
Loading…
Reference in a new issue