free(): invalid pointer - in telebot_put_user
Closed this issue · 1 comments
Hi. My app using telebot is crashing in telebot_put_user. I updated to last commit "Fix memory corruption caused by a variable name mistake."
_#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007ffff7b81537 in __GI_abort () at abort.c:79
#2 0x00007ffff7bd93e8 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff7cf7390 "%s\n")
at ../sysdeps/posix/libc_fatal.c:155
#3 0x00007ffff7be06da in malloc_printerr (str=str@entry=0x7ffff7cf5045 "free(): invalid pointer") at malloc.c:5347
#4 0x00007ffff7be1894 in _int_free (av=, p=, have_lock=0) at malloc.c:4173
#5 0x00007ffff7f97e77 in telebot_put_user () from /usr/local/lib/libtelebot.so.4.7.0
#6 0x00007ffff7f98257 in telebot_put_message () from /usr/local/lib/libtelebot.so.4.7.0
#7 0x00007ffff7f95502 in telebot_put_updates () from /usr/local/lib/libtelebot.so.4.7.0
#8 0x00005555555618ba in main (argc=1, argv=0x7fffffffe4f8) at telebot.cpp:1292
_
telebot.cpp:1292 --> telebot_put_updates(updates, count);
while (1)
{
ret = telebot_get_updates(handle, offset, 20, 0, update_types, 0, &updates, &count);
if (ret != TELEBOT_ERROR_NONE)
continue;
//printf("Number of updates: %d\n", count);
for (index = 0; index < count; index++)
{
message = updates[index].message;
//
if (message.text)
{
char str[1024];
std::vector<string> tokens;
if (strstr(message.text, "/start"))
{
//
ret = telebot_send_message(handle, message.chat->id, str, "HTML",
false, false, updates[index].message.message_id, "");
//
printf("msg: %s\n", str);
}
}
offset = updates[index].update_id + 1;
}
telebot_put_updates(updates, count);
sleep(1);
}
telebot_destroy(handle);```