diff options
Diffstat (limited to 'src/portable/portable.c')
-rw-r--r-- | src/portable/portable.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/portable/portable.c b/src/portable/portable.c index 545a3ed5d2..52f38dc83e 100644 --- a/src/portable/portable.c +++ b/src/portable/portable.c @@ -838,6 +838,7 @@ static int portable_changes_add( _cleanup_free_ char *p = NULL, *s = NULL; PortableChange *c; + int r; assert(path); assert(!changes == !n_changes); @@ -855,19 +856,13 @@ static int portable_changes_add( return -ENOMEM; *changes = c; - p = strdup(path); - if (!p) - return -ENOMEM; - - path_simplify(p); - - if (source) { - s = strdup(source); - if (!s) - return -ENOMEM; + r = path_simplify_alloc(path, &p); + if (r < 0) + return r; - path_simplify(s); - } + r = path_simplify_alloc(source, &s); + if (r < 0) + return r; c[(*n_changes)++] = (PortableChange) { .type_or_errno = type_or_errno, |