Fix the resource release sequence in table update.
Coverity issue: 362882, 363041, 363044, 363047
Fixes:
5074e1d551 ("examples/pipeline: add configuration commands")
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
}
/* Add. */
- if (file_add) {
+ if (file_add)
for (line_id = 1; ; line_id++) {
struct rte_swx_table_entry *entry;
}
}
- fclose(file_add);
- }
/* Delete. */
- if (file_delete) {
+ if (file_delete)
for (line_id = 1; ; line_id++) {
struct rte_swx_table_entry *entry;
}
}
- fclose(file_delete);
- }
-
/* Default. */
- if (file_default) {
+ if (file_default)
for (line_id = 1; ; line_id++) {
struct rte_swx_table_entry *entry;
}
}
- fclose(file_default);
- }
-
status = rte_swx_ctl_pipeline_commit(p->ctl, 1);
if (status) {
snprintf(out, out_size, "Commit failed.");
goto error;
}
- free(line);
rte_swx_ctl_pipeline_table_fprintf(stdout, p->ctl, table_name);
+ free(line);
+ if (file_add)
+ fclose(file_add);
+ if (file_delete)
+ fclose(file_delete);
+ if (file_default)
+ fclose(file_default);
return;
error: