[Coverity 1437930] Potential dereference after null check in matroska_segment_seeker.cpp
Either the check against null is unnecessary, or there may be a null pointer dereference.
In mkv::virtual_segment_c::UpdateCurrentToChapter(stream_t &): Pointer is checked against null but then dereferenced anyway (CWE-476)
430 bool b_has_seeked = false;
431
1. Condition !this->b_current_vchapter_entered, taking true branch.
2. Condition this->p_current_vchapter != NULL, taking false branch.
3. var_compare_op: Comparing this->p_current_vchapter to null implies that this->p_current_vchapter might be null.
432 if ( !b_current_vchapter_entered && p_current_vchapter != NULL )
433 {
434 b_current_vchapter_entered = true;
435 if (p_current_vchapter->Enter( true ))
436 return true;
437 }
438
4. Condition sys.i_pts != 0L, taking true branch.
439 if ( sys.i_pts != VLC_TICK_INVALID )
440 {
5. Condition this->p_current_vchapter != NULL, taking false branch.
441 if ( p_current_vchapter != NULL && p_current_vchapter->ContainsTimestamp( sys.i_pts - VLC_TICK_0 ))
442 p_cur_vchapter = p_current_vchapter;
6. Condition p_cur_vedition != NULL, taking true branch.
443 else if (p_cur_vedition != NULL)
444 p_cur_vchapter = p_cur_vedition->getChapterbyTimecode( sys.i_pts - VLC_TICK_0 );
445 }
446
447 /* we have moved to a new chapter */
7. Condition p_cur_vchapter != NULL, taking true branch.
8. Condition this->p_current_vchapter != p_cur_vchapter, taking true branch.
448 if ( p_cur_vchapter != NULL && p_current_vchapter != p_cur_vchapter )
449 {
9. Condition p_cur_vchapter->p_chapter, taking true branch.
450 msg_Dbg( &demux, "New Chapter %" PRId64 " uid=%" PRIu64, sys.i_pts - VLC_TICK_0,
451 p_cur_vchapter->p_chapter ? p_cur_vchapter->p_chapter->i_uid : 0 );
10. Condition p_cur_vedition->b_ordered, taking true branch.
452 if ( p_cur_vedition->b_ordered )
453 {
454 /* FIXME EnterAndLeave has probably been broken for a long time */
455 // Leave/Enter up to the link point
CID 1437930: (#1 of 1): Dereference after null check (FORWARD_NULL)
11. var_deref_model: Passing null pointer this->p_current_vchapter to EnterAndLeave, which dereferences it.[show details]
456 b_has_seeked = p_cur_vchapter->EnterAndLeave( p_current_vchapter );
457 if ( !b_has_seeked )