mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-03-13 22:56:28 +00:00
Fix memory leak in GetPrettyRRID
This commit is contained in:
parent
86b6b2b1cd
commit
9a1de18491
1 changed files with 6 additions and 7 deletions
|
|
@ -595,9 +595,10 @@ boolean PR_IsLocalPlayerGuest(INT32 player)
|
|||
return !(cv_lastprofile[player].value);
|
||||
}
|
||||
|
||||
static char rrid_buf[256];
|
||||
|
||||
char *GetPrettyRRID(const unsigned char *bin, boolean brief)
|
||||
{
|
||||
char *out;
|
||||
size_t i;
|
||||
size_t len = 32;
|
||||
|
||||
|
|
@ -607,15 +608,13 @@ char *GetPrettyRRID(const unsigned char *bin, boolean brief)
|
|||
if (bin == NULL || len == 0)
|
||||
return NULL;
|
||||
|
||||
out = malloc(len*2 + 1);
|
||||
|
||||
for (i=0; i<len; i++)
|
||||
{
|
||||
out[i*2] = "0123456789ABCDEF"[bin[i] >> 4];
|
||||
out[i*2+1] = "0123456789ABCDEF"[bin[i] & 0x0F];
|
||||
rrid_buf[i*2] = "0123456789ABCDEF"[bin[i] >> 4];
|
||||
rrid_buf[i*2+1] = "0123456789ABCDEF"[bin[i] & 0x0F];
|
||||
}
|
||||
|
||||
out[len*2] = '\0';
|
||||
rrid_buf[len*2] = '\0';
|
||||
|
||||
return out;
|
||||
return rrid_buf;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue