jcs
/amend
/amendments
/77
util: xGetStringAsChar: Properly release resource after use
jcs made amendment 77 over 2 years ago
--- util.c Wed Jun 15 10:03:39 2022
+++ util.c Wed Jun 15 11:34:45 2022
@@ -515,18 +515,18 @@ xGetString(short id)
char *
xGetStringAsChar(short id)
{
- StringHandle h = xGetString(id);
+ StringHandle h;
char *out;
size_t l;
+ h = xGetString(id);
HLock(h);
-
l = (*h)[0];
out = xmalloc(l + 1);
memcpy((void *)out, (void *)(*h + 1), l);
out[l] = '\0';
+ ReleaseResource(h);
- DisposHandle(h);
return out;
}