static bool cg_legacy_filter_and_set_cpus(char *path, bool am_initialized)
{
__do_free char *cpulist = NULL, *fpath = NULL, *isolcpus = NULL,
- *posscpus;
+ *posscpus = NULL;
__do_free uint32_t *isolmask = NULL, *possmask = NULL;
int ret;
ssize_t i;
*p2 = '\0';
if (type == CGROUP_SUPER_MAGIC) {
- __do_free char *dup;
+ __do_free char *dup = NULL;
/* strdup() here for v1 hierarchies. Otherwise
* lxc_iterate_parts() will destroy mountpoints such as
cgroup = must_make_path(h->mountpoint, h->container_base_path, NULL);
for (i = 0; i < parts_len; i++) {
int ret;
- __do_free char *target;
+ __do_free char *target = NULL;
cgroup = must_append_path(cgroup, parts[i], NULL);
target = must_make_path(cgroup, "cgroup.subtree_control", NULL);
for (int i = 0; ops->hierarchies[i]; i++) {
int ret;
- __do_free char *path;
+ __do_free char *path = NULL;
if (monitor)
path = must_make_path(ops->hierarchies[i]->monitor_full_path,
static int recursive_count_nrtasks(char *dirname)
{
__do_free char *path = NULL;
- __do_closedir DIR *dir;
+ __do_closedir DIR *dir = NULL;
struct dirent *direntp;
int count = 0, ret;
for (i = 0; ops->hierarchies[i]; i++) {
int ret;
- __do_free char *fullpath;
+ __do_free char *fullpath = NULL;
fullpath = must_make_path(ops->hierarchies[i]->mountpoint,
ops->hierarchies[i]->container_base_path,
const char *lxcpath)
{
__do_free char *path = NULL;
- __do_free char *controller;
+ __do_free char *controller = NULL;
char *p;
struct hierarchy *h;
int ret = -1;
h = get_hierarchy(ops, controller);
if (h) {
- __do_free char *fullpath;
+ __do_free char *fullpath = NULL;
fullpath = build_full_cgpath_from_monitorpath(h, path, filename);
ret = lxc_read_from_file(fullpath, value, len);
const char *name, const char *lxcpath)
{
__do_free char *path = NULL;
- __do_free char *controller;
+ __do_free char *controller = NULL;
char *p;
struct hierarchy *h;
int ret = -1;
h = get_hierarchy(ops, controller);
if (h) {
- __do_free char *fullpath;
+ __do_free char *fullpath = NULL;
fullpath = build_full_cgpath_from_monitorpath(h, path, filename);
ret = lxc_write_to_file(fullpath, value, strlen(value), false, 0666);
*/
static int convert_devpath(const char *invalue, char *dest)
{
- __do_free char *path;
+ __do_free char *path = NULL;
int n_parts;
char *p, type;
unsigned long minor, major;
static int cg_legacy_set_data(struct cgroup_ops *ops, const char *filename,
const char *value)
{
- __do_free char *controller;
+ __do_free char *controller = NULL;
__do_free char *fullpath = NULL;
char *p;
/* "b|c <2^64-1>:<2^64-1> r|w|m" = 47 chars max */
return false;
lxc_list_for_each(iterator, cgroup_settings) {
- __do_free char *fullpath;
+ __do_free char *fullpath = NULL;
int ret;
struct lxc_cgroup *cg = iterator->elem;
static void cg_unified_delegate(char ***delegate)
{
- __do_free char *tmp;
+ __do_free char *tmp = NULL;
int idx;
char *standard[] = {"cgroup.subtree_control", "cgroup.threads", NULL};
static bool cg_hybrid_init(struct cgroup_ops *ops, bool relative,
bool unprivileged)
{
- __do_free char *basecginfo;
+ __do_free char *basecginfo = NULL;
__do_free char *line = NULL;
__do_fclose FILE *f = NULL;
int ret;
/* Get current cgroup from /proc/self/cgroup for the cgroupfs v2 hierarchy. */
static char *cg_unified_get_current_cgroup(bool relative)
{
- __do_free char *basecginfo;
+ __do_free char *basecginfo = NULL;
char *base_cgroup;
char *copy = NULL;
tmp = lxc_global_config_value("lxc.cgroup.use");
if (tmp) {
- __do_free char *pin;
+ __do_free char *pin = NULL;
char *chop, *cur;
pin = must_copy_string(tmp);