Hi Andy,

Thanks for fixing the memory leak! I've tested it and it solved the
issue. btw, I think we don't have to assign "NULL" to static variable,
C99 standard assume all static variable initializes to 0.

Acked-by: William Tu <u9012...@gmail.com>

On Tue, Jul 26, 2016 at 1:08 PM, Andy Zhou <az...@ovn.org> wrote:
> This patch removes rpc related memory leak reported below.
>
> Reported-at: http://openvswitch.org/pipermail/dev/2016-July/076075.html
> Signed-off-by: Andy Zhou <az...@ovn.org>
> ---
>  ovsdb/ovsdb-server.c | 1 +
>  ovsdb/replication.c  | 5 +++--
>  2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
> index 239cca8..1c6ddca 100644
> --- a/ovsdb/ovsdb-server.c
> +++ b/ovsdb/ovsdb-server.c
> @@ -202,6 +202,7 @@ main_loop(struct ovsdb_jsonrpc_server *jsonrpc, struct 
> shash *all_dbs,
>          }
>      }
>
> +    disconnect_remote_server();
>      free(remotes_error);
>  }
>
> diff --git a/ovsdb/replication.c b/ovsdb/replication.c
> index 52b7085..3d589ef 100644
> --- a/ovsdb/replication.c
> +++ b/ovsdb/replication.c
> @@ -32,8 +32,8 @@
>  #include "table.h"
>  #include "transaction.h"
>
> -static char *remote_ovsdb_server;
> -static struct jsonrpc *rpc;
> +static char *remote_ovsdb_server = NULL;
> +static struct jsonrpc *rpc = NULL;
>  static struct sset monitored_tables = SSET_INITIALIZER(&monitored_tables);
>  static struct sset tables_blacklist = SSET_INITIALIZER(&tables_blacklist);
>  static bool reset_dbs = true;
> @@ -391,6 +391,7 @@ check_for_notifications(struct shash *all_dbs)
>      if (error == EAGAIN) {
>          return;
>      } else if (error) {
> +        jsonrpc_close(rpc);
>          rpc = open_jsonrpc(remote_ovsdb_server);
>          if (!rpc) {
>              /* Remote server went down. */
> --
> 1.9.1
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to