summaryrefslogtreecommitdiff
path: root/lib/librte_sched
diff options
context:
space:
mode:
authorTonghao Zhang <xiangxia.m.yue@gmail.com>2018-11-28 05:55:55 -0800
committerCristian Dumitrescu <cristian.dumitrescu@intel.com>2018-12-22 00:22:57 +0100
commit03b7fd7e545f453f1d7c13d11bf8a0b7cd59a943 (patch)
treebc498bfe4c3a88d90d7f3c323abe6b40bcc740de /lib/librte_sched
parent5d3f72100904b5a2fc6b240e1cc10f1c2dd02267 (diff)
downloaddpdk-03b7fd7e545f453f1d7c13d11bf8a0b7cd59a943.zip
dpdk-03b7fd7e545f453f1d7c13d11bf8a0b7cd59a943.tar.gz
dpdk-03b7fd7e545f453f1d7c13d11bf8a0b7cd59a943.tar.xz
sched: fix memory leak on init failure
In some case, we may create sched port dynamically, if err when creating so memory will leak. Fixes: de3cfa2c9823 ("sched: initial import") Cc: stable@dpdk.org Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Diffstat (limited to 'lib/librte_sched')
-rw-r--r--lib/librte_sched/rte_sched.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
index dd77391..77aed9f 100644
--- a/lib/librte_sched/rte_sched.c
+++ b/lib/librte_sched/rte_sched.c
@@ -654,6 +654,7 @@ rte_sched_port_config(struct rte_sched_port_params *params)
params->red_params[i][j].min_th,
params->red_params[i][j].max_th,
params->red_params[i][j].maxp_inv) != 0) {
+ rte_free(port);
return NULL;
}
}
@@ -713,6 +714,7 @@ rte_sched_port_config(struct rte_sched_port_params *params)
bmp_mem_size);
if (port->bmp == NULL) {
RTE_LOG(ERR, SCHED, "Bitmap init error\n");
+ rte_free(port);
return NULL;
}