The locate-key change in ab89164be02012f1bf159c971853b8610e966301 introduced a
segmentation fault in gnupg when using gpg-wks-client or auto-key-locate without
a local keysource (which is probably why context is NULL).
Crash is reproducible by:
(gdb) run --auto-key-locate clear,wkd,nodefault --locate-key
aheinecke@intevation.de
Starting program: /opt/gnupg/bin/gpg2 --auto-key-locate clear,wkd,nodefault
--locate-key aheinecke@intevation.de
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
gpg: NOTE: THIS IS A DEVELOPMENT VERSION!
gpg: It is only intended for test purposes and should NOT be
gpg: used in a production environment or with production keys!
gpg: key 1FDF723CF462B6B1: "Andre Heinecke <aheinecke@intevation.de>" not changed
gpg: Total number processed: 1
gpg: unchanged: 1
gpg: automatically retrieved 'aheinecke@intevation.de' via WKD
Program received signal SIGSEGV, Segmentation fault.
getkey_next (ctx=0x0, pk=0x7fffffffdb98, ret_keyblock=0x0) at
../../../src/gnupg/g10/getkey.c:2167
2167 keydb_disable_caching (ctx->kr_handle);
(gdb) bt
#0 getkey_next (ctx=0x0, pk=0x7fffffffdb98, ret_keyblock=0x0) at
../../../src/gnupg/g10/getkey.c:2167
#1 0x0000000000423eff in get_best_pubkey_byname (ctrl=0x6ed700,
retctx=0x7fffffffdcc0, pk=0x0,
name=0x6ed76c "aheinecke@intevation.de", ret_keyblock=<optimized out>,
include_unusable=<optimized out>, no_akl=0)
at ../../../src/gnupg/g10/getkey.c:1595
#2 0x00000000004458f1 in locate_one (names=<optimized out>, ctrl=<optimized
out>) at ../../../src/gnupg/g10/keylist.c:653
#3 public_key_list (ctrl=0x6ed700, list=0x6ed760, locate_mode=7264108) at
../../../src/gnupg/g10/keylist.c:141
#4 0x000000000040b006 in main (argc=0, argv=0x7fffffffe270) at
../../../src/gnupg/g10/gpg.c:4167