On Wed, Apr 19, 2017 at 05:43:56PM +0800, Fam Zheng wrote:
> +static void test_aio_context_failure(void)
> +{
> +    Error *local_err = NULL;
> +    BlockBackend *blk1 = blk_new(BLK_PERM_AIO_CONTEXT_CHANGE,
> +                                 BLK_PERM_ALL & 
> ~BLK_PERM_AIO_CONTEXT_CHANGE);
> +    BlockBackend *blk2 = blk_new(BLK_PERM_AIO_CONTEXT_CHANGE, BLK_PERM_ALL);
> +    BlockDriverState *bs = bdrv_open("null-co://", NULL, NULL, 0, 
> &error_abort);
> +
> +    blk_insert_bs(blk1, bs, &error_abort);
> +    blk_insert_bs(blk2, bs, &local_err);
> +
> +    g_assert_nonnull(local_err);

The following asserts and also frees the Error object to prevent leaking
memory:

error_free_or_abort(local_err);

Attachment: signature.asc
Description: PGP signature

Reply via email to