Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fca59755 authored by Tomas Hozza's avatar Tomas Hozza Committed by Greg Kroah-Hartman
Browse files

tools: hv: Fix file descriptor leaks



Close "fd" file descriptor when is goes out of scope so it does
not leak.

Signed-off-by: default avatarTomas Hozza <thozza@redhat.com>
Acked-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f14e600a
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -257,12 +257,15 @@ static int kvp_file_init(void)


		filep = fopen(fname, "re");
		if (!filep)
		if (!filep) {
			close(fd);
			return 1;
		}

		record = malloc(alloc_unit * num_blocks);
		if (record == NULL) {
			fclose(filep);
			close(fd);
			return 1;
		}
		for (;;) {
@@ -286,6 +289,7 @@ static int kvp_file_init(void)
						num_blocks);
				if (record == NULL) {
					fclose(filep);
					close(fd);
					return 1;
				}
				continue;