Add cgroup_free_group_spec procedure which free cgroups_group_spec
variable.
Signed-off-by: Ivana Varekova <varekova@redhat.com>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
return 0;
}
+
+
+/**
+ * Free a single cgroup_group_spec structure
+ * <--->@param cl The structure to free from memory.
+ */
+void cgroup_free_group_spec(struct cgroup_group_spec *cl)
+{
+ /* Loop variable */
+ int i = 0;
+
+ /* Make sure our structure is not NULL, first. */
+ if (!cl) {
+ cgroup_dbg("Warning: Attempted to free NULL rule.\n");
+ return;
+ }
+
+ /* We must free any used controller strings, too. */
+ for (i = 0; i < CG_CONTROLLER_MAX; i++) {
+ if (cl->controllers[i])
+ free(cl->controllers[i]);
+ }
+
+ free(cl);
+}
+
+
*/
int parse_cgroup_spec(struct cgroup_group_spec *cdptr[], char *optarg);
+/**
+ * Free a single cgroup_group_spec structure.
+ * @param cl The structure to free from memory
+ */
+void cgroup_free_group_spec(struct cgroup_group_spec *cl);
#endif /* TOOLS_COMMON */