Skip to content

Commit 5fc17db

Browse files
committed
Coverity rxtx/rtp fixes
- destroy struct rtp only if not nullptr (CID 909223) in case of init failure - CID 909226 is just a code flow issue that arises when refactoring - now just single message is dispatched ih this place but there used to be more types
1 parent ac68057 commit 5fc17db

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/video_rxtx/rtp.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,10 @@ initialize_network(const char *addr, int recv_port, int send_port,
362362
static void
363363
destroy_rtp_device(struct rtp *network_device)
364364
{
365-
rtp_done(network_device);
365+
if (network_device != nullptr) {
366+
rtp_done(network_device);
367+
}
368+
network_device = nullptr;
366369
}
367370

368371
void rtp_rxtx_set_pbuf_delay(struct rtp_rxtx_common *s, double delay) {

src/video_rxtx/ultragrid_rtp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,14 +250,14 @@ void ultragrid_rtp_video_rxtx::receiver_process_messages()
250250
case RECEIVER_MSG_VIDEO_PROP_CHANGED:
251251
rtp_rxtx_set_pbuf_delay(m_rtp_common,
252252
1.0 / msg->new_desc.fps);
253+
free_message((struct message *) msg,
254+
new_response(RESPONSE_OK, nullptr));
253255
break;
254256
default:
255257
assert(0 && "Wrong message passed to "
256258
"ultragrid_rtp_video_rxtx::receiver_"
257259
"process_messages()");
258260
}
259-
260-
free_message((struct message *) msg, r ? r : new_response(RESPONSE_OK, NULL));
261261
}
262262
}
263263

0 commit comments

Comments
 (0)