netdev-dpdk: fix mbuf leaks
[cascardo/ovs.git] / ovsdb / execution.c
index 300c247..de25a87 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc.
+/* Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -15,7 +15,6 @@
 
 #include <config.h>
 
-#include <assert.h>
 #include <limits.h>
 
 #include "column.h"
@@ -141,7 +140,7 @@ ovsdb_execute(struct ovsdb *db, const struct ovsdb_session *session,
 
         /* Parse and execute operation. */
         ovsdb_parser_init(&parser, operation,
-                          "ovsdb operation %zu of %zu", i, n_operations);
+                          "ovsdb operation %"PRIuSIZE" of %"PRIuSIZE, i, n_operations);
         op = ovsdb_parser_member(&parser, "op", OP_ID);
         result = json_object_create();
         if (op) {
@@ -154,7 +153,7 @@ ovsdb_execute(struct ovsdb *db, const struct ovsdb_session *session,
                                          op_name);
             }
         } else {
-            assert(ovsdb_parser_has_error(&parser));
+            ovs_assert(ovsdb_parser_has_error(&parser));
         }
 
         /* A parse error overrides any other error.
@@ -248,7 +247,7 @@ parse_table(struct ovsdb_execution *x,
     return table;
 }
 
-static WARN_UNUSED_RESULT struct ovsdb_error *
+static OVS_WARN_UNUSED_RESULT struct ovsdb_error *
 parse_row(const struct json *json, const struct ovsdb_table *table,
           struct ovsdb_symbol_table *symtab,
           struct ovsdb_row **rowp, struct ovsdb_column_set *columns)
@@ -644,6 +643,8 @@ ovsdb_execute_wait(struct ovsdb_execution *x, struct ovsdb_parser *parser,
         } else {
             timeout_msec = LLONG_MAX;
         }
+    }
+    if (!error) {
         if (strcmp(json_string(until), "==")
             && strcmp(json_string(until), "!=")) {
             error = ovsdb_syntax_error(until, NULL,
@@ -660,6 +661,7 @@ ovsdb_execute_wait(struct ovsdb_execution *x, struct ovsdb_parser *parser,
             error = ovsdb_row_from_json(row, rows->u.array.elems[i], x->symtab,
                                         NULL);
             if (error) {
+                ovsdb_row_destroy(row);
                 break;
             }