Skip to content

Commit

Permalink
lib-sieve: Handle duplicate registrations of capabilities better.
Browse files Browse the repository at this point in the history
This would uselessly allocate a new entry with the same content.
  • Loading branch information
stephanbosch committed Jun 23, 2016
1 parent 27fca19 commit 3278187
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/lib-sieve/sieve-extensions.c
Expand Up @@ -827,9 +827,15 @@ void sieve_extension_capabilities_register
{
struct sieve_instance *svinst = ext->svinst;
struct sieve_extension_registry *ext_reg = svinst->ext_reg;
struct sieve_capability_registration *reg =
p_new(svinst->pool, struct sieve_capability_registration, 1);
struct sieve_capability_registration *reg;

reg = hash_table_lookup(ext_reg->capabilities_index, cap->name);
if (reg != NULL) {
/* Already registered */
return;
}

reg = p_new(svinst->pool, struct sieve_capability_registration, 1);
reg->ext = ext;
reg->capabilities = cap;

Expand Down

0 comments on commit 3278187

Please sign in to comment.