Plug some leaks
This commit is contained in:
parent
7a2507c52f
commit
495690ea5e
@ -341,9 +341,8 @@ void rc_set_service_daemon (const char *service, const char *exec,
|
|||||||
oldfile = ffile;
|
oldfile = ffile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ffile)
|
|
||||||
free (ffile);
|
free (ffile);
|
||||||
free (files);
|
rc_strlist_free (files);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now store our daemon info */
|
/* Now store our daemon info */
|
||||||
@ -413,7 +412,7 @@ bool rc_service_started_daemon (const char *service, const char *exec,
|
|||||||
if (retval)
|
if (retval)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
free (files);
|
rc_strlist_free (files);
|
||||||
}
|
}
|
||||||
|
|
||||||
free (mexec);
|
free (mexec);
|
||||||
|
@ -230,7 +230,7 @@ static char **find_mounts (struct args *args)
|
|||||||
# error "Operating system not supported!"
|
# error "Operating system not supported!"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static regex_t *get_regex (char *string)
|
static regex_t *get_regex (const char *string)
|
||||||
{
|
{
|
||||||
regex_t *reg = rc_xmalloc (sizeof (regex_t));
|
regex_t *reg = rc_xmalloc (sizeof (regex_t));
|
||||||
int result;
|
int result;
|
||||||
@ -279,6 +279,8 @@ int mountinfo (int argc, char **argv)
|
|||||||
#define DO_REG(_var) \
|
#define DO_REG(_var) \
|
||||||
if (_var) free (_var); \
|
if (_var) free (_var); \
|
||||||
_var = get_regex (optarg);
|
_var = get_regex (optarg);
|
||||||
|
#define REG_FREE(_var) \
|
||||||
|
if (_var) { regfree (_var); free (_var); }
|
||||||
|
|
||||||
memset (&args, 0, sizeof (struct args));
|
memset (&args, 0, sizeof (struct args));
|
||||||
args.mount_type = mount_to;
|
args.mount_type = mount_to;
|
||||||
@ -333,18 +335,12 @@ int mountinfo (int argc, char **argv)
|
|||||||
|
|
||||||
nodes = find_mounts (&args);
|
nodes = find_mounts (&args);
|
||||||
|
|
||||||
if (args.fstype_regex)
|
REG_FREE (args.fstype_regex);
|
||||||
regfree (args.fstype_regex);
|
REG_FREE (args.skip_fstype_regex);
|
||||||
if (args.skip_fstype_regex)
|
REG_FREE (args.node_regex);
|
||||||
regfree (args.skip_fstype_regex);
|
REG_FREE (args.skip_node_regex);
|
||||||
if (args.node_regex)
|
REG_FREE (args.options_regex);
|
||||||
regfree (args.node_regex);
|
REG_FREE (args.skip_options_regex);
|
||||||
if (args.skip_node_regex)
|
|
||||||
regfree (args.skip_node_regex);
|
|
||||||
if (args.options_regex)
|
|
||||||
regfree (args.options_regex);
|
|
||||||
if (args.skip_options_regex)
|
|
||||||
regfree (args.skip_options_regex);
|
|
||||||
|
|
||||||
rc_strlist_reverse (nodes);
|
rc_strlist_reverse (nodes);
|
||||||
|
|
||||||
@ -360,10 +356,8 @@ int mountinfo (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
rc_strlist_free (nodes);
|
rc_strlist_free (nodes);
|
||||||
|
|
||||||
if (point_regex)
|
REG_FREE (point_regex);
|
||||||
regfree (point_regex);
|
REG_FREE (skip_point_regex);
|
||||||
if (skip_point_regex)
|
|
||||||
regfree (skip_point_regex);
|
|
||||||
|
|
||||||
exit (result);
|
exit (result);
|
||||||
}
|
}
|
||||||
|
5
src/rc.c
5
src/rc.c
@ -1140,8 +1140,9 @@ int main (int argc, char **argv)
|
|||||||
CHAR_FREE (tmp);
|
CHAR_FREE (tmp);
|
||||||
} else {
|
} else {
|
||||||
/* Store our list of coldplugged services */
|
/* Store our list of coldplugged services */
|
||||||
rc_strlist_join (&coldplugged_services,
|
tmplist = rc_ls_dir (RC_SVCDIR_COLDPLUGGED, RC_LS_INITD);
|
||||||
rc_ls_dir (RC_SVCDIR_COLDPLUGGED, RC_LS_INITD));
|
rc_strlist_join (&coldplugged_services, tmplist);
|
||||||
|
rc_strlist_free (tmplist);
|
||||||
if (strcmp (newlevel ? newlevel : runlevel, RC_LEVEL_SINGLE) != 0 &&
|
if (strcmp (newlevel ? newlevel : runlevel, RC_LEVEL_SINGLE) != 0 &&
|
||||||
strcmp (newlevel ? newlevel : runlevel, RC_LEVEL_SHUTDOWN) != 0 &&
|
strcmp (newlevel ? newlevel : runlevel, RC_LEVEL_SHUTDOWN) != 0 &&
|
||||||
strcmp (newlevel ? newlevel : runlevel, RC_LEVEL_REBOOT) != 0)
|
strcmp (newlevel ? newlevel : runlevel, RC_LEVEL_REBOOT) != 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user