~lttng/lttng-ust/lttng-ust

Viewing all changes in revision 2987.

  • Committer: Mathieu Desnoyers
  • Date: 2022-07-25 19:53:17 UTC
  • Revision ID: git-v1:0446ebf343709f77a41d9f703daaf1174b079d37
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

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: