Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Jan 2026 17:03:02 +0000
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: b26a7af438f3 - main - heimdal: Pass the correct pointer to free in an error case
Message-ID:  <697e35c6.19516.42ccd72a@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=b26a7af438f36dcde86f39a681123cc2140affb2

commit b26a7af438f36dcde86f39a681123cc2140affb2
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-01-31 17:00:44 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-01-31 17:00:44 +0000

    heimdal: Pass the correct pointer to free in an error case
    
    This fixes a warning reported by GCC 14 on stable/14:
    
    crypto/heimdal/lib/hdb/keys.c:241:13: warning: 'free' called on pointer 'ext' with nonzero offset 16 [-Wfree-nonheap-object]
      241 |             free(hist_keys);
          |             ^~~~~~~~~~~~~~~
    crypto/heimdal/lib/hdb/keys.c:234:15: note: returned from 'calloc'
      234 |         ext = calloc(1, sizeof (*ext));
          |               ^~~~~~~~~~~~~~~~~~~~~~~~
    
    Reviewed by:    rmacklem, cy
    Fixes:          5000d023a446 ("heimdal-kadmin: Add support for the -f dump option")
    Differential Revision:  https://reviews.freebsd.org/D54932
---
 crypto/heimdal/lib/hdb/keys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/heimdal/lib/hdb/keys.c b/crypto/heimdal/lib/hdb/keys.c
index 9c0af5c47f23..ef6113610009 100644
--- a/crypto/heimdal/lib/hdb/keys.c
+++ b/crypto/heimdal/lib/hdb/keys.c
@@ -238,7 +238,7 @@ hdb_add_current_keys_to_history(krb5_context context, hdb_entry *entry)
 	hist_keys = &ext->data.u.hist_keys;
 	hist_keys->val = calloc(1, sizeof (*hist_keys->val));
 	if (hist_keys->val == NULL) {
-	    free(hist_keys);
+	    free(ext);
 	    return ENOMEM;
 	}
 	hist_keys->len = 1;


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?697e35c6.19516.42ccd72a>