Mercurial > libdvdnav.hg
comparison searching.c @ 398:ec2408d48b85 src
in dvdnav_describe_chapters() ifo could be leaked in case of erros; fixed by Erik Hovland
author | nicodvb |
---|---|
date | Wed, 22 Apr 2009 07:40:57 +0000 |
parents | 9c5aef10d165 |
children | af0b6a8bf7e9 |
comparison
equal
deleted
inserted
replaced
397:a70f79850e5f | 398:ec2408d48b85 |
---|---|
549 uint32_t dvdnav_describe_title_chapters(dvdnav_t *this, int32_t title, uint64_t **times, uint64_t *duration) { | 549 uint32_t dvdnav_describe_title_chapters(dvdnav_t *this, int32_t title, uint64_t **times, uint64_t *duration) { |
550 int32_t retval=0; | 550 int32_t retval=0; |
551 uint16_t parts, i; | 551 uint16_t parts, i; |
552 title_info_t *ptitle = NULL; | 552 title_info_t *ptitle = NULL; |
553 ptt_info_t *ptt = NULL; | 553 ptt_info_t *ptt = NULL; |
554 ifo_handle_t *ifo; | 554 ifo_handle_t *ifo = NULL; |
555 pgc_t *pgc; | 555 pgc_t *pgc; |
556 cell_playback_t *cell; | 556 cell_playback_t *cell; |
557 uint64_t length, *tmp=NULL; | 557 uint64_t length, *tmp=NULL; |
558 | 558 |
559 *times = NULL; | 559 *times = NULL; |
569 this->started = 1; | 569 this->started = 1; |
570 } | 570 } |
571 ifo = vm_get_title_ifo(this->vm, title); | 571 ifo = vm_get_title_ifo(this->vm, title); |
572 if(!ifo || !ifo->vts_pgcit) { | 572 if(!ifo || !ifo->vts_pgcit) { |
573 printerr("Couldn't open IFO for chosen title, exit."); | 573 printerr("Couldn't open IFO for chosen title, exit."); |
574 retval = 0; | |
574 goto fail; | 575 goto fail; |
575 } | 576 } |
576 | 577 |
577 ptitle = &this->vm->vmgi->tt_srpt->title[title-1]; | 578 ptitle = &this->vm->vmgi->tt_srpt->title[title-1]; |
578 parts = ptitle->nr_of_ptts; | 579 parts = ptitle->nr_of_ptts; |
609 cellnr++; | 610 cellnr++; |
610 } while(cellnr < endcellnr); | 611 } while(cellnr < endcellnr); |
611 } | 612 } |
612 *duration = length; | 613 *duration = length; |
613 vm_ifo_close(ifo); | 614 vm_ifo_close(ifo); |
615 ifo = NULL; | |
614 retval = parts; | 616 retval = parts; |
615 *times = tmp; | 617 *times = tmp; |
616 | 618 |
617 fail: | 619 fail: |
618 pthread_mutex_unlock(&this->vm_lock); | 620 pthread_mutex_unlock(&this->vm_lock); |
621 if(!retval && ifo) | |
622 vm_ifo_close(ifo); | |
619 if(!retval && tmp) | 623 if(!retval && tmp) |
620 free(tmp); | 624 free(tmp); |
621 return retval; | 625 return retval; |
622 } | 626 } |