mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-15 13:58:32 +00:00
FS-10167: Added test to identify issue with ks_pool_realloc
This commit is contained in:
1 parent
e26e873268
commit
7861bb0d49
2 files changed
+52
No files matched your search
@@ -0,0 +1,47 @@
|
||||
#include "ks.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "tap.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
ks_pool_t *pool;
|
||||
uint32_t *buf = NULL;
|
||||
intptr_t ptr = 0;
|
||||
|
||||
ks_init();
|
||||
|
||||
plan(3);
|
||||
|
||||
ks_pool_open(&pool);
|
||||
|
||||
buf = (uint32_t *)ks_pool_resize(pool, buf, sizeof(uint32_t) * 1);
|
||||
ok(buf != NULL);
|
||||
|
||||
ptr = (intptr_t)buf;
|
||||
|
||||
buf = (uint32_t *)ks_pool_resize(pool, buf, sizeof(uint32_t) * 2);
|
||||
ok(buf != NULL);
|
||||
|
||||
ok((intptr_t)buf == ptr);
|
||||
|
||||
buf = (uint32_t *)ks_pool_resize(pool, buf, sizeof(uint32_t) * 1);
|
||||
ok(buf != NULL);
|
||||
|
||||
ok((intptr_t)buf == ptr);
|
||||
|
||||
buf = (uint32_t *)ks_pool_resize(pool, buf, sizeof(uint32_t) * 2);
|
||||
ok(buf != NULL);
|
||||
|
||||
ok((intptr_t)buf == ptr);
|
||||
|
||||
ks_pool_free(pool, &buf);
|
||||
|
||||
ks_pool_close(&pool);
|
||||
|
||||
ks_shutdown();
|
||||
|
||||
done_testing();
|
||||
}
|
||||
Reference in new issue
Block a user