diff options
| author | Frédéric Desbiens <[email protected]> | 2026-10-02 10:42:44 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-10-02 10:42:44 -0400 |
| commit | 93387b0a60382a29579bbad5045c68328e3751df (patch) | |
| tree | 42be790d602cb76f55090e5a7c418df7ea2b3428 /utility/rtos_compatibility_layers/posix/px_mq_send.c | |
| parent | 44d7c95c582d415c4ad84527180b29c93c3bf664 (diff) | |
| parent | 28281cd5647d4671236ca08d19bd18ed15b2265a (diff) | |
Merge pull request #783 from eclipse-threadx/devv6.5.2.202603_rel
Merged changes ahead of the v6.5.2.202603 release
Diffstat (limited to 'utility/rtos_compatibility_layers/posix/px_mq_send.c')
| -rw-r--r-- | utility/rtos_compatibility_layers/posix/px_mq_send.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/utility/rtos_compatibility_layers/posix/px_mq_send.c b/utility/rtos_compatibility_layers/posix/px_mq_send.c index 464af01f..f641419a 100644 --- a/utility/rtos_compatibility_layers/posix/px_mq_send.c +++ b/utility/rtos_compatibility_layers/posix/px_mq_send.c @@ -60,6 +60,7 @@ /* */ /* tx_thread_identify returns currently running thread */ /* tx_byte_allocate allocate memory */ +/* tx_byte_release release memory */ /* tx_queue_send ThreadX queue send */ /* posix_priority_search search message for same priority */ /* */ @@ -166,7 +167,16 @@ ULONG msg[TX_POSIX_MESSAGE_SIZE]; if (temp1 != TX_SUCCESS) { - posix_internal_error(9999); + posix_internal_error(9999); + + /* posix_internal_error() does not return today, but do not depend on + that: bp is indeterminate here, so falling through would copy + msg_len bytes through an unset pointer. */ + posix_errno = ENOMEM; + posix_set_pthread_errno(ENOMEM); + + /* Return ERROR. */ + return(ERROR); } /* Got the memory , Setup source and destination pointers Cast them in UCHAR as message length is in bytes. */ @@ -201,9 +211,14 @@ ULONG msg[TX_POSIX_MESSAGE_SIZE]; temp1 = tx_queue_send(Queue, msg, TX_WAIT_FOREVER); if ( temp1 != TX_SUCCESS) { + /* The message was never handed over to the queue, so this function + still owns the private buffer. Release it before returning, + otherwise it is leaked from the queue's byte pool. */ + tx_byte_release(bp); + /* POSIX doesn't have error for this, hence give default. */ posix_errno = EINTR ; - posix_set_pthread_errno(EINTR); + posix_set_pthread_errno(EINTR); /* Return ERROR. */ return(ERROR); |
