if (isempty(eq))
r = sd_bus_message_append(m, "(sv)", field, "a(ss)", 0);
else {
+ _cleanup_free_ char *_path = NULL;
const char *path = eq, *rwm = NULL, *e;
e = strchr(eq, ' ');
if (e) {
- path = strndupa_safe(eq, e - eq);
+ path = _path = strndup(eq, e - eq);
+ if (!path)
+ return log_oom();
+
rwm = e + 1;
}
"Failed to parse %s value %s.",
field, eq);
- const char *path = strndupa_safe(eq, e - eq);
const char *bandwidth = e + 1;
+ _cleanup_free_ char *path = strndup(eq, e - eq);
+ if (!path)
+ return log_oom();
uint64_t bytes;
if (streq(bandwidth, "infinity"))
"Failed to parse %s value %s.",
field, eq);
- const char *path = strndupa_safe(eq, e - eq);
const char *weight = e + 1;
+ _cleanup_free_ char *path = strndup(eq, e - eq);
+ if (!path)
+ return log_oom();
uint64_t u;
r = safe_atou64(weight, &u);
"Failed to parse %s value %s.",
field, eq);
- const char *path = strndupa_safe(eq, e - eq);
const char *target = e + 1;
+ _cleanup_free_ char *path = strndup(eq, e - eq);
+ if (!path)
+ return log_oom();
usec_t usec;
r = parse_sec(target, &usec);
};
int bus_append_unit_property_assignment(sd_bus_message *m, UnitType t, const char *assignment) {
- const char *eq, *field;
+ _cleanup_free_ char *field = NULL;
+ const char *eq;
int r;
assert(m);
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Not an assignment: %s", assignment);
- field = strndupa_safe(assignment, eq - assignment);
+
+ field = strndup(assignment, eq - assignment);
+ if (!field)
+ return log_oom();
eq++;
for (const BusProperty** tables = ASSERT_PTR(unit_type_properties[t]); *tables; tables++)