]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
equix: avoid a coverity warning in hashx_alloc()
authorMicah Elizabeth Scott <beth@torproject.org>
Thu, 11 May 2023 18:10:15 +0000 (11:10 -0700)
committerMicah Elizabeth Scott <beth@torproject.org>
Thu, 11 May 2023 18:10:15 +0000 (11:10 -0700)
This addresses one of the warnings in issue #40792. As far as I can tell
this is a false positive, since the use of "ctx->type" in hashx_free()
can only be hit after the unioned code/program pointer is non-NULL. It's
no big deal to zero this value explicitly to silence the warning though.

Signed-off-by: Micah Elizabeth Scott <beth@torproject.org>
src/ext/equix/hashx/src/context.c

index de2144d46c53c1848ad601b481435af69908d485..8548fb7ffab066e699a10a29713eed06017d7c42 100644 (file)
@@ -41,6 +41,7 @@ hashx_ctx* hashx_alloc(hashx_type type) {
                goto failure;
        }
        ctx->code = NULL;
+       ctx->type = 0;
        if (type & HASHX_COMPILED) {
                if (!hashx_compiler_init(ctx)) {
                        goto failure;