RTEMS | record-server.c: CID 1634787: Error handling issues (#5150)

Gedare Bloom (@gedare) gitlab at rtems.org
Wed Nov 13 17:52:32 UTC 2024



Gedare Bloom created an issue: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5150

Assignee: Sebastian Huber

## Summary
<!--
Please provide as much information as possible such as error messages or attaching logs
-->

The `rtems_record_server()` may attempt to `close()` an unsuccessful `socket()` or it may attempt to close an invalid descriptor (initialized to `-1`) in case the `rtems_timer_create()` failed. The `error` handling section needs to be refactored.

```
*** CID 1634787:  Error handling issues  (NEGATIVE_RETURNS)
/cpukit/libtrace/record/record-server.c: 251 in rtems_record_server()
245         (void) close( cd );
246       }
247     
248     error:
249     
250       free( items );
>>>     CID 1634787:  Error handling issues  (NEGATIVE_RETURNS)
>>>     "sd" is passed to a parameter that cannot be negative. [Note: The source code implementation of the function has been overridden by a builtin model.]
251       (void) close( sd );
252       (void) rtems_timer_delete( timer );
253     }
254     
255     typedef struct {
256       rtems_id       task;
```

## Steps to reproduce


### Pre-set options

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5150
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20241113/ab50bdaa/attachment.htm>


More information about the bugs mailing list