/*
- * Copyright (c) 2012 William Pitcock <nenolod@dereferenced.org>.
+ * Copyright (c) 2012 Ariadne Conill <ariadne@dereferenced.org>.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
if ((entry = rb_dictionary_retrieve(idx->cap_dict, cap)) != NULL)
{
entry->flags &= ~CAP_ORPHANED;
+ if (ownerdata != NULL)
+ {
+ s_assert(entry->ownerdata == NULL);
+ entry->ownerdata = ownerdata;
+ }
return (1 << entry->value);
}
entry = rb_malloc(sizeof(struct CapabilityEntry));
- entry->cap = cap;
+ entry->cap = rb_strdup(cap);
entry->flags = 0;
entry->value = idx->highest_bit;
entry->ownerdata = ownerdata;
{
s_assert(delem != NULL);
- rb_free(delem->data);
+ struct CapabilityEntry *entry = delem->data;
+ rb_free((char *)entry->cap);
+ rb_free(entry);
}
struct CapabilityIndex *