diff mbox series

[ovs-dev,1/1] ovsdb: Fix memory leak on error path in ovsdb_file_read__().

Message ID ae6dc26157587fc88408d3cf420286d38bc9e642.1654512973.git.wangyunjian@huawei.com
State Accepted
Commit cb9ae5f0fd047cba19725841739432707db1c525
Headers show
Series [ovs-dev,1/1] ovsdb: Fix memory leak on error path in ovsdb_file_read__(). | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Yunjian Wang June 6, 2022, 11:06 a.m. UTC
Found by Coverity.

Fixes: 1b1d2e6daa56 ("ovsdb: Introduce experimental support for clustered databases.")
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 ovsdb/file.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Mike Pattrick June 17, 2022, 4:19 p.m. UTC | #1
On Mon, Jun 6, 2022 at 7:07 AM Yunjian Wang via dev
<ovs-dev@openvswitch.org> wrote:
>
> Found by Coverity.
>
> Fixes: 1b1d2e6daa56 ("ovsdb: Introduce experimental support for clustered databases.")
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>

Looks correct to me!

Acked-by: Mike Pattrick <mkp@redhat.com>

> ---
>  ovsdb/file.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/ovsdb/file.c b/ovsdb/file.c
> index 9f44007d9..ca80c2823 100644
> --- a/ovsdb/file.c
> +++ b/ovsdb/file.c
> @@ -524,6 +524,7 @@ ovsdb_file_read__(const char *filename, bool rw,
>
>          error = ovsdb_txn_replay_commit(txn);
>          if (error) {
> +            ovsdb_error_destroy(error);
>              ovsdb_storage_unread(storage);
>              break;
>          }
> --
> 2.27.0
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
Ilya Maximets June 28, 2022, 4:22 p.m. UTC | #2
On 6/17/22 18:19, Mike Pattrick wrote:
> On Mon, Jun 6, 2022 at 7:07 AM Yunjian Wang via dev
> <ovs-dev@openvswitch.org> wrote:
>>
>> Found by Coverity.
>>
>> Fixes: 1b1d2e6daa56 ("ovsdb: Introduce experimental support for clustered databases.")
>> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> 
> Looks correct to me!
> 
> Acked-by: Mike Pattrick <mkp@redhat.com>
> 

Thanks!  Applied and backported down to 2.13.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/ovsdb/file.c b/ovsdb/file.c
index 9f44007d9..ca80c2823 100644
--- a/ovsdb/file.c
+++ b/ovsdb/file.c
@@ -524,6 +524,7 @@  ovsdb_file_read__(const char *filename, bool rw,
 
         error = ovsdb_txn_replay_commit(txn);
         if (error) {
+            ovsdb_error_destroy(error);
             ovsdb_storage_unread(storage);
             break;
         }