From: Jan Kiszka <[email protected]> We can write the same thing much simpler, avoiding the duplicate cleanup paths.
Signed-off-by: Jan Kiszka <[email protected]> --- env/env_disk_utils.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/env/env_disk_utils.c b/env/env_disk_utils.c index 78ad130..cb70407 100644 --- a/env/env_disk_utils.c +++ b/env/env_disk_utils.c @@ -22,6 +22,7 @@ const char *tmp_mnt_dir = "/tmp/mnt-XXXXXX"; char *get_mountpoint(char *devpath) { + char *mntpoint = NULL; struct mntent *part; FILE *mtab; @@ -33,19 +34,13 @@ char *get_mountpoint(char *devpath) while ((part = getmntent(mtab)) != NULL) { if ((part->mnt_fsname != NULL) && (strcmp(part->mnt_fsname, devpath)) == 0) { - char *mntpoint; - mntpoint = strdup(part->mnt_dir); - if (!mntpoint) { - break; - } - endmntent(mtab); - return mntpoint; + break; } } endmntent(mtab); - return NULL; + return mntpoint; } bool mount_partition(CONFIG_PART *cfgpart) -- 2.16.4 -- You received this message because you are subscribed to the Google Groups "EFI Boot Guard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/efibootguard-dev/4e55aa4e-5e0f-8920-a304-b0b20864c47b%40siemens.com. For more options, visit https://groups.google.com/d/optout.
