tree-wide: add missing assertions
Found by coccinelle.
This commit is contained in:
@@ -100,7 +100,7 @@ static bool output_show_machine(const char *name, char **patterns) {
|
||||
|
||||
static int get_machine_list(
|
||||
sd_bus *bus,
|
||||
struct machine_info **_machine_infos,
|
||||
struct machine_info **ret_machine_infos,
|
||||
char **patterns) {
|
||||
|
||||
struct machine_info *machine_infos = NULL;
|
||||
@@ -108,6 +108,9 @@ static int get_machine_list(
|
||||
_cleanup_free_ char *hn = NULL;
|
||||
int c = 0, r;
|
||||
|
||||
assert(bus);
|
||||
assert(ret_machine_infos);
|
||||
|
||||
hn = gethostname_malloc();
|
||||
if (!hn)
|
||||
return log_oom();
|
||||
@@ -153,7 +156,7 @@ static int get_machine_list(
|
||||
c++;
|
||||
}
|
||||
|
||||
*_machine_infos = machine_infos;
|
||||
*ret_machine_infos = machine_infos;
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
@@ -519,8 +519,10 @@ int unit_find_paths(
|
||||
*/
|
||||
|
||||
assert(unit_name);
|
||||
assert(ret_fragment_path);
|
||||
assert(lp);
|
||||
assert(cached_id_map);
|
||||
assert(cached_name_map);
|
||||
assert(ret_fragment_path);
|
||||
|
||||
/* Go via the bus to acquire the path, unless we are explicitly told not to, or when the unit name is a template */
|
||||
if (!force_client_side &&
|
||||
@@ -529,6 +531,8 @@ int unit_find_paths(
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
_cleanup_free_ char *load_state = NULL, *dbus_path = NULL;
|
||||
|
||||
assert(bus);
|
||||
|
||||
dbus_path = unit_dbus_path_from_name(unit_name);
|
||||
if (!dbus_path)
|
||||
return log_oom();
|
||||
|
||||
Reference in New Issue
Block a user