return error;
}
+/* Parse a string representation of a meter modification message to '*mm'.
+ * If successful, 'mm->meter.bands' must be free()d by the caller. */
static char * OVS_WARN_UNUSED_RESULT
parse_ofp_meter_mod_str__(struct ofputil_meter_mod *mm, char *string,
struct ofpbuf *bands, int command,
mm->command = command;
mm->meter.meter_id = 0;
mm->meter.flags = 0;
+ mm->meter.n_bands = 0;
+ mm->meter.bands = NULL;
+
if (fields & F_BANDS) {
band_str = strstr(string, "band");
if (!band_str) {
}
}
}
- } else {
- mm->meter.n_bands = 0;
- mm->meter.bands = NULL;
}
return NULL;
* page) into 'mm' for sending the specified meter_mod 'command' to a switch.
*
* Returns NULL if successful, otherwise a malloc()'d string describing the
- * error. The caller is responsible for freeing the returned string. */
+ * error. The caller is responsible for freeing the returned string.
+ * If successful, 'mm->meter.bands' must be free()d by the caller. */
char * OVS_WARN_UNUSED_RESULT
parse_ofp_meter_mod_str(struct ofputil_meter_mod *mm, const char *str_,
int command, enum ofputil_protocol *usable_protocols)
usable_protocols = OFPUTIL_P_OF13_UP;
mm.command = command;
mm.meter.meter_id = OFPM13_ALL;
+ mm.meter.bands = NULL;
}
protocol = open_vconn_for_flow_mod(bridge, &vconn, usable_protocols);
version = ofputil_protocol_to_ofp_version(protocol);
transact_noreply(vconn, ofputil_encode_meter_mod(version, &mm));
+ free(mm.meter.bands);
vconn_close(vconn);
}
} else {
usable_protocols = OFPUTIL_P_OF13_UP;
mm.meter.meter_id = OFPM13_ALL;
+ mm.meter.bands = NULL;
}
protocol = open_vconn_for_flow_mod(bridge, &vconn, usable_protocols);
version = ofputil_protocol_to_ofp_version(protocol);
dump_transaction(vconn, ofputil_encode_meter_request(version, type,
mm.meter.meter_id));
+ free(mm.meter.bands);
vconn_close(vconn);
}