New upstream version 17.11.3
[deb_dpdk.git] / drivers / crypto / scheduler / rte_cryptodev_scheduler.c
index 822ce27..59ece95 100644 (file)
@@ -119,8 +119,10 @@ update_scheduler_capability(struct scheduler_ctx *sched_ctx)
        struct rte_cryptodev_capabilities tmp_caps[256] = { {0} };
        uint32_t nb_caps = 0, i;
 
-       if (sched_ctx->capabilities)
+       if (sched_ctx->capabilities) {
                rte_free(sched_ctx->capabilities);
+               sched_ctx->capabilities = NULL;
+       }
 
        for (i = 0; i < sched_ctx->nb_slaves; i++) {
                struct rte_cryptodev_info dev_info;
@@ -490,8 +492,10 @@ rte_cryptodev_scheduler_load_user_scheduler(uint8_t scheduler_id,
        sched_ctx->ops.option_set = scheduler->ops->option_set;
        sched_ctx->ops.option_get = scheduler->ops->option_get;
 
-       if (sched_ctx->private_ctx)
+       if (sched_ctx->private_ctx) {
                rte_free(sched_ctx->private_ctx);
+               sched_ctx->private_ctx = NULL;
+       }
 
        if (sched_ctx->ops.create_private_ctx) {
                int ret = (*sched_ctx->ops.create_private_ctx)(dev);