mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Fix memory leak in base62_encode()
This commit is contained in:
parent
7e314b2cc3
commit
330e99381e
3 changed files with 4 additions and 4 deletions
|
|
@ -121,10 +121,9 @@ unsigned long djb2_hash(const unsigned char *str)
|
|||
}
|
||||
|
||||
// Function to encode a number to base62
|
||||
char *base62_encode(unsigned long num)
|
||||
void *base62_encode(unsigned long num, char *output)
|
||||
{
|
||||
const char base62_chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
char *output = (char *) malloc(5); // 4 characters + null terminator
|
||||
if (output == NULL)
|
||||
{
|
||||
tio_error_print("Memory allocation failed");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue