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 02946df6d02a58104813c046b52da2fd88e598dc..e7d3b50def7d95d95340b8ec30aab0e10aaada6e 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);
     }
 }