Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libcrypt Free strdup'd value in libargon decode_option e...



details:   https://anonhg.NetBSD.org/src/rev/8c40f8017223
branches:  trunk
changeset: 366503:8c40f8017223
user:      abs <abs%NetBSD.org@localhost>
date:      Sun May 29 10:51:41 2022 +0000

description:
Free strdup'd value in libargon decode_option error paths

If its worth freeing in the success path, its worth freeing in the
error path... (given we don't _exit or similar)

diffstat:

 lib/libcrypt/crypt-argon2.c |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (23 lines):

diff -r 00d63a91d70f -r 8c40f8017223 lib/libcrypt/crypt-argon2.c
--- a/lib/libcrypt/crypt-argon2.c       Sun May 29 10:47:39 2022 +0000
+++ b/lib/libcrypt/crypt-argon2.c       Sun May 29 10:51:41 2022 +0000
@@ -328,6 +328,7 @@
                                }
                                break;
                        default:
+                                free(in);
                                return -1;
 
                }
@@ -337,8 +338,10 @@
 
        sl = ctx->saltlen;
 
-       if (from_base64(ctx->salt, &sl, a) == NULL)
+       if (from_base64(ctx->salt, &sl, a) == NULL) {
+                free(in);
                return -1;
+        }
 
        ctx->saltlen = sl;
 



Home | Main Index | Thread Index | Old Index