]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Add a check for NULL in pageant_forget_passphrases().
authorSimon Tatham <anakin@pobox.com>
Thu, 14 May 2015 08:16:26 +0000 (09:16 +0100)
committerSimon Tatham <anakin@pobox.com>
Thu, 14 May 2015 08:16:26 +0000 (09:16 +0100)
I've no reason to believe it will _currently_ be called with the
'passphrases' tree not even set up yet, but I managed to get that to
happen while playing about with experimental code just now, and it
seemed like a good safety check to keep in general.

pageant.c

index 2bb1c8f55cef2cdca20634d030b16634c476b486..da320681ff138feddb5d85bf6f4769e583cf1ee2 100644 (file)
--- a/pageant.c
+++ b/pageant.c
@@ -1172,6 +1172,9 @@ static tree234 *passphrases = NULL;
  */
 void pageant_forget_passphrases(void)
 {
+    if (!passphrases)                  /* in case we never set it up at all */
+        return;
+
     while (count234(passphrases) > 0) {
        char *pp = index234(passphrases, 0);
        smemclr(pp, strlen(pp));