[2/2] sched: fix possible mem leak on initialize
Checks
Commit Message
In some case, we may create sched port dynamically,
if err when creating so memory will leak.
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
lib/librte_sched/rte_sched.c | 1 +
1 file changed, 1 insertion(+)
Comments
ping
On Wed, Nov 28, 2018 at 9:56 PM Tonghao Zhang <xiangxia.m.yue@gmail.com> wrote:
>
> In some case, we may create sched port dynamically,
> if err when creating so memory will leak.
>
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> ---
> lib/librte_sched/rte_sched.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
> index 17de6e6..a3adcca 100644
> --- a/lib/librte_sched/rte_sched.c
> +++ b/lib/librte_sched/rte_sched.c
> @@ -724,6 +724,7 @@ struct rte_sched_port *
> bmp_mem_size);
> if (port->bmp == NULL) {
> RTE_LOG(ERR, SCHED, "Bitmap init error\n");
> + rte_free(port);
> return NULL;
> }
>
> --
> 1.8.3.1
>
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Tonghao Zhang
> Sent: Tuesday, December 11, 2018 2:54 AM
> To: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 2/2] sched: fix possible mem leak on initialize
>
> ping
> On Wed, Nov 28, 2018 at 9:56 PM Tonghao Zhang
> <xiangxia.m.yue@gmail.com> wrote:
> >
> > In some case, we may create sched port dynamically,
> > if err when creating so memory will leak.
> >
> > Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > ---
> > lib/librte_sched/rte_sched.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
> > index 17de6e6..a3adcca 100644
> > --- a/lib/librte_sched/rte_sched.c
> > +++ b/lib/librte_sched/rte_sched.c
> > @@ -724,6 +724,7 @@ struct rte_sched_port *
> > bmp_mem_size);
> > if (port->bmp == NULL) {
> > RTE_LOG(ERR, SCHED, "Bitmap init error\n");
> > + rte_free(port);
> > return NULL;
> > }
> >
> > --
> > 1.8.3.1
> >
Also fixed another identical issue in the same function.
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Applied to next-qos tree, thanks!
@@ -724,6 +724,7 @@ struct rte_sched_port *
bmp_mem_size);
if (port->bmp == NULL) {
RTE_LOG(ERR, SCHED, "Bitmap init error\n");
+ rte_free(port);
return NULL;
}