[ovs-dev,1/1] ovn-northd: fix memory leak in add_distributed_nat_routes() function
diff mbox series

Message ID 1564569781-15676-1-git-send-email-damjan.skvarc@gmail.com
State New
Headers show
Series
  • [ovs-dev,1/1] ovn-northd: fix memory leak in add_distributed_nat_routes() function
Related show

Commit Message

Damijan Skvarc July 31, 2019, 10:43 a.m. UTC
Within this function actions & match dynamic strings are used as helper
variables for adding entries into logical flow table. Variables are
used several times in order to optimize number of memory allocations,
however at the end memory was forgotten to be deallocated.

Signed-off-by: Damijan Skvarc <damjan.skvarc@gmail.com>
---
 northd/ovn-northd.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Mark Michelson July 31, 2019, 1:17 p.m. UTC | #1
Thanks for the fix!
Acked-by: Mark Michelson <mmichels@redhat.com>

This will need a backport to the OVS 2.12 branch as well.

On 7/31/19 6:43 AM, Damijan Skvarc wrote:
> Within this function actions & match dynamic strings are used as helper
> variables for adding entries into logical flow table. Variables are
> used several times in order to optimize number of memory allocations,
> however at the end memory was forgotten to be deallocated.
> 
> Signed-off-by: Damijan Skvarc <damjan.skvarc@gmail.com>
> ---
>   northd/ovn-northd.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
> index 979dea4..8588961 100644
> --- a/northd/ovn-northd.c
> +++ b/northd/ovn-northd.c
> @@ -5667,6 +5667,8 @@ add_distributed_nat_routes(struct hmap *lflows, const struct ovn_port *op)
>               ds_clear(&actions);
>           }
>       }
> +    ds_destroy(&match);
> +    ds_destroy(&actions);
>   }
>   
>   static void
>
Mark Michelson July 31, 2019, 4:40 p.m. UTC | #2
I've pushed this to OVN master. Damijan, could you post a backport patch 
for OVS 2.12, please? Thanks!

On 7/31/19 9:17 AM, Mark Michelson wrote:
> Thanks for the fix!
> Acked-by: Mark Michelson <mmichels@redhat.com>
> 
> This will need a backport to the OVS 2.12 branch as well.
> 
> On 7/31/19 6:43 AM, Damijan Skvarc wrote:
>> Within this function actions & match dynamic strings are used as helper
>> variables for adding entries into logical flow table. Variables are
>> used several times in order to optimize number of memory allocations,
>> however at the end memory was forgotten to be deallocated.
>>
>> Signed-off-by: Damijan Skvarc <damjan.skvarc@gmail.com>
>> ---
>>   northd/ovn-northd.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
>> index 979dea4..8588961 100644
>> --- a/northd/ovn-northd.c
>> +++ b/northd/ovn-northd.c
>> @@ -5667,6 +5667,8 @@ add_distributed_nat_routes(struct hmap *lflows, 
>> const struct ovn_port *op)
>>               ds_clear(&actions);
>>           }
>>       }
>> +    ds_destroy(&match);
>> +    ds_destroy(&actions);
>>   }
>>   static void
>>
>
0-day Robot Aug. 1, 2019, 3:34 p.m. UTC | #3
Bleep bloop.  Greetings Damijan Skvarc, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


git-am:
fatal: sha1 information is lacking or useless (northd/ovn-northd.c).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 ovn-northd: fix memory leak in add_distributed_nat_routes() function
The copy of the patch that failed is found in:
   /var/lib/jenkins/jobs/upstream_build_from_pw/workspace/.git/rebase-apply/patch
When you have resolved this problem, run "git am --resolved".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


Please check this out.  If you feel there has been an error, please email aconole@bytheb.org

Thanks,
0-day Robot
Damijan Skvarc Aug. 2, 2019, 6:26 a.m. UTC | #4
Done!
Thanks for review.

On Wed, Jul 31, 2019 at 6:40 PM Mark Michelson <mmichels@redhat.com> wrote:

> I've pushed this to OVN master. Damijan, could you post a backport patch
> for OVS 2.12, please? Thanks!
>
> On 7/31/19 9:17 AM, Mark Michelson wrote:
> > Thanks for the fix!
> > Acked-by: Mark Michelson <mmichels@redhat.com>
> >
> > This will need a backport to the OVS 2.12 branch as well.
> >
> > On 7/31/19 6:43 AM, Damijan Skvarc wrote:
> >> Within this function actions & match dynamic strings are used as helper
> >> variables for adding entries into logical flow table. Variables are
> >> used several times in order to optimize number of memory allocations,
> >> however at the end memory was forgotten to be deallocated.
> >>
> >> Signed-off-by: Damijan Skvarc <damjan.skvarc@gmail.com>
> >> ---
> >>   northd/ovn-northd.c | 2 ++
> >>   1 file changed, 2 insertions(+)
> >>
> >> diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
> >> index 979dea4..8588961 100644
> >> --- a/northd/ovn-northd.c
> >> +++ b/northd/ovn-northd.c
> >> @@ -5667,6 +5667,8 @@ add_distributed_nat_routes(struct hmap *lflows,
> >> const struct ovn_port *op)
> >>               ds_clear(&actions);
> >>           }
> >>       }
> >> +    ds_destroy(&match);
> >> +    ds_destroy(&actions);
> >>   }
> >>   static void
> >>
> >
>
>

Patch
diff mbox series

diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index 979dea4..8588961 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -5667,6 +5667,8 @@  add_distributed_nat_routes(struct hmap *lflows, const struct ovn_port *op)
             ds_clear(&actions);
         }
     }
+    ds_destroy(&match);
+    ds_destroy(&actions);
 }
 
 static void