diff mbox

[ovs-dev,3/4] ovsdb: Fix bug, set rpc to NULL after freeing.

Message ID 1470268625-69697-3-git-send-email-azhou@ovn.org
State Accepted
Headers show

Commit Message

Andy Zhou Aug. 3, 2016, 11:57 p.m. UTC
Found by inspection

Signed-off-by: Andy Zhou <azhou@ovn.org>
---
 ovsdb/replication.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Ben Pfaff Aug. 14, 2016, 5:14 a.m. UTC | #1
On Wed, Aug 03, 2016 at 04:57:04PM -0700, Andy Zhou wrote:
> Found by inspection
> 
> Signed-off-by: Andy Zhou <azhou@ovn.org>

It's not obvious from the context that this can cause a problem, but I
think it's safe in any case.

Acked-by: Ben Pfaff <blp@ovn.org>
Andy Zhou Aug. 15, 2016, 6:25 a.m. UTC | #2
On Sat, Aug 13, 2016 at 10:14 PM, Ben Pfaff <blp@ovn.org> wrote:

> On Wed, Aug 03, 2016 at 04:57:04PM -0700, Andy Zhou wrote:
> > Found by inspection
> >
> > Signed-off-by: Andy Zhou <azhou@ovn.org>
>
> It's not obvious from the context that this can cause a problem, but I
> think it's safe in any case.
>
> Acked-by: Ben Pfaff <blp@ovn.org>
>

Thanks, It happens to fix a real bug, as discussed at:
http://openvswitch.org/pipermail/discuss/2016-August/022322.html

I will add the reference to the commit message.
diff mbox

Patch

diff --git a/ovsdb/replication.c b/ovsdb/replication.c
index 19626a5..de6eec1 100644
--- a/ovsdb/replication.c
+++ b/ovsdb/replication.c
@@ -150,6 +150,7 @@  void
 disconnect_active_server(void)
 {
     jsonrpc_close(rpc);
+    rpc = NULL;
     sset_clear(&monitored_tables);
     sset_clear(&tables_blacklist);
 }
@@ -157,7 +158,7 @@  disconnect_active_server(void)
 void
 destroy_active_server(void)
 {
-    jsonrpc_close(rpc);
+    disconnect_active_server();
     sset_destroy(&monitored_tables);
     sset_destroy(&tables_blacklist);