Fix: file descriptor leak in get_possible_cpu_mask_from_sysfs
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 25 Jul 2022 19:53:17 +0000 (15:53 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 25 Jul 2022 19:53:17 +0000 (15:53 -0400)
commit0446ebf343709f77a41d9f703daaf1174b079d37
treed383c7167d8954de2f4b668a5f958ce8f0a92dc9
parentfe9615ba34edf2deb2b7f7dea935806a94627e9f
Fix: file descriptor leak in get_possible_cpu_mask_from_sysfs

Found by Coverity:

*** CID 1490808:  Resource leaks  (RESOURCE_LEAK)
/src/common/smp.c: 125 in get_possible_cpu_mask_from_sysfs()
119                                     max_bytes - total_bytes_read);
120
121                     if (bytes_read < 0) {
122                             if (errno == EINTR) {
123                                     continue;        /* retry operation */
124                             } else {
>>>     CID 1490808:  Resource leaks  (RESOURCE_LEAK)
>>>     Handle variable "fd" going out of scope leaks the handle.
125                                     return -1;
126                             }
127                     }
128
129                     total_bytes_read += bytes_read;
130                     assert(total_bytes_read <= max_bytes);

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I372b1fa2d454eeaa6462fe9c13692983369bea6b
src/common/smp.c
This page took 0.027024 seconds and 4 git commands to generate.