Originally, the function dp_enumerate() initialized the 'all_dps'
argument. This is inconsistent with most other functions that take an
svec argument, which would only clear the contents. Further, if someone
were not careful when reusing the svec, it could lead to memory leaks.
With this change, the caller is expected to first call svec_init() on
the argument.
}
}
-/* Initializes 'all_dps' and enumerates the names of all known created
- * datapaths, where possible, into it. Returns 0 if successful, otherwise a
- * positive errno value.
+/* Clears 'all_dps' and enumerates the names of all known created datapaths,
+ * where possible, into it. The caller must first initialize 'all_dps'.
+ * Returns 0 if successful, otherwise a positive errno value.
*
* Some kinds of datapaths might not be practically enumerable. This is not
* considered an error. */
int error;
int i;
- svec_init(all_dps);
+ svec_clear(all_dps);
error = 0;
for (i = 0; i < N_DPIF_CLASSES; i++) {
const struct dpif_class *class = dpif_classes[i];
unixctl_command_register("fdb/show", bridge_unixctl_fdb_show);
+ svec_init(&dpif_names);
dp_enumerate(&dpif_names);
for (i = 0; i < dpif_names.n; i++) {
const char *dpif_name = dpif_names.names[i];