コード例 #1
0
ファイル: anonymous_shared.c プロジェクト: AIdrifter/samba
static bool test_anonymous_shared_simple(struct torture_context *tctx)
{
	void *ptr;
	size_t len;

	torture_comment(tctx, "anonymous_shared_free(NULL)\n");
	anonymous_shared_free(NULL);

	len = 500;
	torture_comment(tctx, "anonymous_shared_allocate(%llu)\n",
			(unsigned long long)len);
	ptr = anonymous_shared_allocate(len);
	torture_assert(tctx, ptr, "valid pointer");
	memset(ptr, 0xfe, len);
	torture_comment(tctx, "anonymous_shared_free(ptr)\n");
	anonymous_shared_free(ptr);

	len = 50000;
	torture_comment(tctx, "anonymous_shared_allocate(%llu)\n",
			(unsigned long long)len);
	ptr = anonymous_shared_allocate(len);
	torture_assert(tctx, ptr, "valid pointer");
	memset(ptr, 0xfe, len);
	torture_comment(tctx, "anonymous_shared_free(ptr)\n");
	anonymous_shared_free(ptr);

	memset(&len, 0xFF, sizeof(len));
	torture_comment(tctx, "anonymous_shared_allocate(%llu)\n",
			(unsigned long long)len);
	ptr = anonymous_shared_allocate(len);
	torture_assert(tctx, ptr == NULL, "null pointer");

	return true;
}
コード例 #2
0
ファイル: signing.c プロジェクト: rchicoli/samba
static int smbd_shm_signing_destructor(struct smbd_shm_signing *s)
{
    anonymous_shared_free(s->shm_pointer);
    return 0;
}
コード例 #3
0
ファイル: server_prefork.c プロジェクト: AIdrifter/samba
static int prefork_pool_destructor(struct prefork_pool *pfp)
{
	anonymous_shared_free(pfp->pool);
	return 0;
}