Skip to content

Commit 5d5ed62

Browse files
jyvetbgoglin
authored andcommitted
linux: Fix a ressource leak
leaked_storage: Variable fd going out of scope leaks the storage it points to. Signed-off-by: Jean-Yves VET <[email protected]>
1 parent 8b93818 commit 5d5ed62

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

hwloc/topology-linux.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5318,8 +5318,10 @@ hwloc__get_firmware_dmi_memory_info(struct hwloc_topology *topology,
53185318
break;
53195319

53205320
err = fread(&header, sizeof(header), 1, fd);
5321-
if (err != 1)
5321+
if (err != 1) {
5322+
fclose(fd);
53225323
break;
5324+
}
53235325
if (header.length < sizeof(header)) {
53245326
/* invalid, or too old entry/spec that doesn't contain what we need */
53255327
fclose(fd);

0 commit comments

Comments
 (0)