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:		5000d023a4 ("heimdal-kadmin: Add support for the -f dump option")
Differential Revision:	https://reviews.freebsd.org/D54932
This commit is contained in:
John Baldwin
2026-01-31 12:00:44 -05:00
parent 8a8dc73ef8
commit b26a7af438
+1 -1
View File
@@ -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;