Home GnuPG
Diffusion GnuPG e175152ef751

agent: Fix double free.
e175152ef751Unpublished

Unpublished Commit ยท Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

agent: Fix double free.

* agent/cache.c (agent_store_cache_hit): Make sure the update is
atomic.

Previously, the function freed the last key, and duplicated the new
key after doing that. There is a chance, however, that calling the
allocator surrenders control to a different thread, causing a double
free if a different thread also calls this function.

To make sure the update is atomic under the non-preemptive thread
model, we must make sure not to surrender control to a different
thread. Therefore, we avoid calling the allocator during the
update.

  • Signed-off-by: Justus Winter <justus@g10code.com>

Details

Provenance
justusAuthored on Jan 25 2017, 1:51 PM
Parents
rG5f2da5d439de: tests: Skip GPGME tests that are not built.
Branches
Unknown
Tags
Unknown

Event Timeline

Justus Winter <justus@g10code.com> committed rGe175152ef751: agent: Fix double free. (authored by Justus Winter <justus@g10code.com>).Jan 25 2017, 1:51 PM