pkbuf leak is fixed

This commit is contained in:
Sukchan Lee 2017-02-10 13:26:48 +09:00
parent fa7b4fef58
commit d1cecfb589
4 changed files with 22 additions and 29 deletions

View File

@ -71,12 +71,6 @@ dnl Checks for compile flag
dnl Checks for pointer size
AC_CHECK_SIZEOF(void*, 4)
if test "x$ac_cv_sizeof_voidp" != "x"; then
voidp_size=$ac_cv_sizeof_voidp
else
AC_ERROR([Cannot determine size of void*])
fi
dnl Checks for integer size
AC_CHECK_SIZEOF(char, 1)
AC_CHECK_SIZEOF(int, 4)
@ -138,7 +132,6 @@ else
AC_ERROR([could not detect a 64-bit integer type])
fi
AC_SUBST(voidp_size)
AC_SUBST(short_value)
AC_SUBST(int_value)
AC_SUBST(long_value)

View File

@ -173,12 +173,10 @@ typedef unsigned @short_value@ c_uint16_t;
typedef @int_value@ c_int32_t;
typedef unsigned @int_value@ c_uint32_t;
#define C_SIZEOF_VOIDP @voidp_size@
typedef @long_value@ c_int64_t;
typedef unsigned @long_value@ c_uint64_t;
#if C_SIZEOF_VOIDP == 8
#if SIZEOF_VOIDP == 8
typedef c_uint64_t c_uintptr_t;
typedef c_int64_t c_intptr_t;
#else

View File

@ -13,7 +13,7 @@ pool_declare(clbuf_pool, clbuf_t, MAX_NUM_OF_CLBUF);
pool_declare(pkbuf_pool, pkbuf_t, MAX_NUM_OF_PKBUF);
#undef BOUNDARY
#define BOUNDARY 4
#define BOUNDARY SIZEOF_VOIDP
#define SIZEOF_CLUSTER_128 CORE_ALIGN(128+MAX_SIZEOF_HEADROOM, BOUNDARY)
#define SIZEOF_CLUSTER_256 CORE_ALIGN(256+MAX_SIZEOF_HEADROOM, BOUNDARY)
@ -63,6 +63,8 @@ status_t pkbuf_init(void)
}
status_t pkbuf_final(void)
{
pkbuf_show();
pool_final(&clbuf_pool);
pool_final(&pkbuf_pool);
@ -80,24 +82,22 @@ status_t pkbuf_final(void)
void pkbuf_show(void)
{
d_print("Pkbuf : Size = %d, Avail = %d\n",pool_size(&pkbuf_pool),
pool_avail(&pkbuf_pool));
d_print("clfbuf : Size = %d, Avail = %d\n\n",pool_size(&clbuf_pool),
pool_avail(&clbuf_pool));
d_print("cluster128 : Size = %d, Avail = %d\n",pool_size(&cluster_128_pool),
pool_avail(&cluster_128_pool));
d_print("cluster256 : Size = %d, Avail = %d\n",pool_size(&cluster_256_pool),
pool_avail(&cluster_256_pool));
d_print("cluster512 : Size = %d, Avail = %d\n",pool_size(&cluster_512_pool),
pool_avail(&cluster_512_pool));
d_print("cluster1024 : Size = %d, Avail = %d\n",
pool_size(&cluster_1024_pool),
pool_avail(&cluster_128_pool));
d_print("cluster2048 : Size = %d, Avail = %d\n",
pool_size(&cluster_2048_pool),
pool_avail(&cluster_2048_pool));
d_print("%d not freed in pkbuf_t pool\n",
pool_size(&pkbuf_pool) - pool_avail(&pkbuf_pool));
d_print("%d not freed in clbuf_t pool\n",
pool_size(&clbuf_pool) - pool_avail(&clbuf_pool));
d_print("%d not freed in cluster128_t pool\n",
pool_size(&cluster_128_pool) - pool_avail(&cluster_128_pool));
d_print("%d not freed in cluster256_t pool\n",
pool_size(&cluster_256_pool) - pool_avail(&cluster_256_pool));
d_print("%d not freed in cluster512_t pool\n",
pool_size(&cluster_512_pool) - pool_avail(&cluster_512_pool));
d_print("%d not freed in cluster1024_t pool\n",
pool_size(&cluster_1024_pool) - pool_avail(&cluster_128_pool));
d_print("%d not freed in cluster2048_t pool\n",
pool_size(&cluster_2048_pool) - pool_avail(&cluster_2048_pool));
d_print("%d not freed in cluster8192_t pool\n",
pool_size(&cluster_8192_pool) - pool_avail(&cluster_8192_pool));
}
static clbuf_t* clbuf_alloc(c_uint16_t length);

View File

@ -137,6 +137,8 @@ static void s1ap_test5(abts_case *tc, void *data)
ABTS_INT_EQUAL(tc, 280, erval);
s1ap_free_pdu(&message);
pkbuf_free(pkbuf);
}
abts_suite *test_s1ap(abts_suite *suite)