summaryrefslogtreecommitdiff
path: root/src/gpt-auto-generator
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2015-07-29 20:25:57 +0200
committerDaniel Mack <daniel@zonque.org>2015-07-30 13:09:01 +0200
commit2fc09a9cdd1ad25bc7c53a23d5301eb952e1ce3d (patch)
treec662c5bf209dae93822ac07a831882a7ba4ba0b2 /src/gpt-auto-generator
parent5f17089ac1e86c25806d3f066243561360efd2ca (diff)
tree-wide: use free_and_strdup()
Use free_and_strdup() where appropriate and replace equivalent, open-coded versions.
Diffstat (limited to 'src/gpt-auto-generator')
-rw-r--r--src/gpt-auto-generator/gpt-auto-generator.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
index 9fc576fb45..50acb7595c 100644
--- a/src/gpt-auto-generator/gpt-auto-generator.c
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
@@ -727,9 +727,8 @@ static int enumerate_partitions(dev_t devnum) {
boot_nr = nr;
- free(boot);
- boot = strdup(subnode);
- if (!boot)
+ r = free_and_strdup(&boot, subnode);
+ if (r < 0)
return log_oom();
} else if (sd_id128_equal(type_id, GPT_HOME)) {
@@ -741,9 +740,8 @@ static int enumerate_partitions(dev_t devnum) {
home_nr = nr;
home_rw = !(flags & GPT_FLAG_READ_ONLY),
- free(home);
- home = strdup(subnode);
- if (!home)
+ r = free_and_strdup(&home, subnode);
+ if (r < 0)
return log_oom();
} else if (sd_id128_equal(type_id, GPT_SRV)) {
@@ -755,9 +753,8 @@ static int enumerate_partitions(dev_t devnum) {
srv_nr = nr;
srv_rw = !(flags & GPT_FLAG_READ_ONLY),
- free(srv);
- srv = strdup(subnode);
- if (!srv)
+ r = free_and_strdup(&srv, subnode);
+ if (r < 0)
return log_oom();
}
}