From: Daniel Golle Date: Sat, 14 Aug 2021 17:30:48 +0000 (+0100) Subject: block: fix two resources leaks discovered by Coverity X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=2e3aca299ea7bbe74f219860510c4b34e77c7aa4;p=project%2Ffstools.git block: fix two resources leaks discovered by Coverity Coverity CID: 1412456 Resource leak Coverity CID: 1412458 Resource leak Signed-off-by: Daniel Golle --- diff --git a/block.c b/block.c index d839838..9f5cebf 100644 --- a/block.c +++ b/block.c @@ -931,6 +931,8 @@ static int handle_mount(const char *source, const char *target, err = exec_mount(source, target, fstype, mount_opts); } + free(mount_opts); + return err; } @@ -1131,9 +1133,10 @@ static int umount_device(char *path, int type, bool all) if (!mp) return -1; - if (!strcmp(mp, "/") && !all) + if (!strcmp(mp, "/") && !all) { + free(mp); return 0; - + } if (type != TYPE_AUTOFS) blockd_notify("umount", basename(path), NULL, NULL);