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:54:26 +0000 (15:54 -0400)
commit377f1df52583fe775177806d23dc8128b43e838f
tree570500a03f96f287ac62b8f2acf1065fe2da1438
parent6cc1e0de85bc39e2209e1e198e0c433aeffa5687
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.024956 seconds and 4 git commands to generate.