ovsdb-client: Fix memory leaks in "monitor" command.
authorBen Pfaff <blp@nicira.com>
Tue, 2 Feb 2010 22:09:41 +0000 (14:09 -0800)
committerBen Pfaff <blp@nicira.com>
Tue, 2 Feb 2010 23:21:10 +0000 (15:21 -0800)
This is a long-running command so it makes sense to free received messages.
Freeing the schema at exit is not essential but cleans up valgrind
output.

Found with valgrind.

ovsdb/ovsdb-client.c

index 02946df..e7d3b50 100644 (file)
@@ -833,6 +833,7 @@ do_monitor(int argc, char *argv[])
 
         error = jsonrpc_recv_block(rpc, &msg);
         if (error) {
+            ovsdb_schema_destroy(schema);
             ovs_fatal(error, "%s: receive failed", argv[1]);
         }
 
@@ -862,6 +863,7 @@ do_monitor(int argc, char *argv[])
                 fflush(stdout);
             }
         }
+        jsonrpc_msg_destroy(msg);
     }
 }