From aced075a9f89ae4d97eaf00205b973adb0a9b2ef Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Wed, 17 Dec 2025 20:06:21 +0100 Subject: [PATCH] lib/DtSvc: Free memory more soundly It _probably_ works to just pass free(ptr) another two arguments, but compilers don't like this kind of sloppiness anymore. The call site only expects this function to free the first value, ignoring the other two, so model that in the local wrapper function. --- cde/lib/DtSvc/DtUtil1/strtab.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cde/lib/DtSvc/DtUtil1/strtab.c b/cde/lib/DtSvc/DtUtil1/strtab.c index 1770617cb..dcf48961d 100644 --- a/cde/lib/DtSvc/DtUtil1/strtab.c +++ b/cde/lib/DtSvc/DtUtil1/strtab.c @@ -151,13 +151,18 @@ _DtShmProtoInitStrtab(int sizeguess) return((DtShmProtoStrtab) ptr); } +static int destroy_hashval(int *ptr, int *unused, unsigned char *unused2) { + free(ptr); + return 0; +} + int _DtShmProtoDestroyStrtab(DtShmProtoStrtab strlist) { strlist_t * ptr = (strlist_t *) strlist; _DtUtilDestroyHash(ptr->sl_hash, NULL, NULL); - _DtUtilDestroyHash(ptr->sl_bosons, (des_func)free, NULL); + _DtUtilDestroyHash(ptr->sl_bosons, destroy_hashval, NULL); free(ptr); return(0); }