cisco / libsrtp

Library for SRTP (Secure Realtime Transport Protocol)
Other
1.19k stars 472 forks source link

Unexecuted lines in the `update_template_streams` function #568

Closed saygins closed 2 years ago

saygins commented 2 years ago

Hi, new_stream_list variable is defined at the beginning of the the update_template_streams function.

srtp_stream_t new_stream_list = NULL;

It is not used until the while loop

if (status) {
    /* free new allocations */
    while (new_stream_list != NULL) {
        srtp_stream_t next = new_stream_list->next;
        srtp_stream_dealloc(new_stream_list, new_stream_template);
        new_stream_list = next;
    }
    srtp_stream_dealloc(new_stream_template, NULL);
    return status;
}

So the condition will be always false. I think it was forgotten to assign a value to this variable before the while loop.

pabuhler commented 2 years ago

but this is inside a for (;;) {} loop, so it wont be set the first time, but can be set the second time around. Or does that not make sense ?

saygins commented 2 years ago

sorry, I didn't see, thanks.