comparison stream/stream_dvdnav.c @ 36555:46a0b7b3db4c

dvdnav: fix memory leaks in error paths.
author reimar
date Sun, 19 Jan 2014 22:24:46 +0000
parents 3389262720da
children 456840015a07
comparison
equal deleted inserted replaced
36554:d75b3dce7851 36555:46a0b7b3db4c
105 return NULL; 105 return NULL;
106 } 106 }
107 107
108 dvd_set_speed(priv->filename, dvd_speed); 108 dvd_set_speed(priv->filename, dvd_speed);
109 109
110 if(dvdnav_open(&(priv->dvdnav),priv->filename)!=DVDNAV_STATUS_OK) 110 if(dvdnav_open(&(priv->dvdnav),priv->filename)!=DVDNAV_STATUS_OK || !priv->dvdnav)
111 { 111 {
112 dvd_set_speed(priv->filename, -1);
112 free(priv->filename); 113 free(priv->filename);
113 free(priv);
114 return NULL;
115 }
116
117 if (!priv->dvdnav) {
118 free(priv); 114 free(priv);
119 return NULL; 115 return NULL;
120 } 116 }
121 117
122 if(1) //from vlc: if not used dvdnav from cvs will fail 118 if(1) //from vlc: if not used dvdnav from cvs will fail
620 616
621 if(p->track > 0) { 617 if(p->track > 0) {
622 priv->title = p->track; 618 priv->title = p->track;
623 if(dvdnav_title_play(priv->dvdnav, p->track) != DVDNAV_STATUS_OK) { 619 if(dvdnav_title_play(priv->dvdnav, p->track) != DVDNAV_STATUS_OK) {
624 mp_msg(MSGT_OPEN,MSGL_FATAL,"dvdnav_stream, couldn't select title %d, error '%s'\n", p->track, dvdnav_err_to_string(priv->dvdnav)); 620 mp_msg(MSGT_OPEN,MSGL_FATAL,"dvdnav_stream, couldn't select title %d, error '%s'\n", p->track, dvdnav_err_to_string(priv->dvdnav));
621 stream_dvdnav_close(stream);
625 return STREAM_UNSUPPORTED; 622 return STREAM_UNSUPPORTED;
626 } 623 }
627 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_DVD_CURRENT_TITLE=%d\n", p->track); 624 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_DVD_CURRENT_TITLE=%d\n", p->track);
628 } else if (p->track == 0) { 625 } else if (p->track == 0) {
629 if(dvdnav_menu_call(priv->dvdnav, DVD_MENU_Root) != DVDNAV_STATUS_OK) 626 if(dvdnav_menu_call(priv->dvdnav, DVD_MENU_Root) != DVDNAV_STATUS_OK)