crypt: Really set result to NULL if get_asymmetric_key() fails.
authorAndre Noll <maan@systemlinux.org>
Mon, 15 Aug 2011 18:09:54 +0000 (20:09 +0200)
committerAndre Noll <maan@systemlinux.org>
Tue, 16 Aug 2011 18:28:32 +0000 (20:28 +0200)
The error path of this function sets the local variable "result"
is set to NULL, which is useless. We must store NULL in the pointer
variable whose address was passed to the function, so "*result =
NULL" is correct.

crypt.c

diff --git a/crypt.c b/crypt.c
index f064fb3..5b7029d 100644 (file)
--- a/crypt.c
+++ b/crypt.c
@@ -204,7 +204,7 @@ out:
                ret = ret2;
        if (ret < 0) {
                free(key);
-               result = NULL;
+               *result = NULL;
                PARA_ERROR_LOG("key %s: %s\n", key_file, para_strerror(-ret));
        } else
                *result = key;