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.
This commit is contained in:
Patrick Georgi 2025-12-17 20:06:21 +01:00
parent ae001c320f
commit aced075a9f
1 changed files with 6 additions and 1 deletions

View File

@ -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);
}