mirror of
https://github.com/mpv-player/mpv
synced 2025-03-25 04:38:01 +00:00
Enhance portability and remove error prone usage of realloc()
patch by Björn Sandell <biorn@dce.chalmers.se> git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9316 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
fc52bafec0
commit
d90e9cb669
@ -761,21 +761,16 @@ int gui_no_filename=0;
|
||||
use_gui=0;
|
||||
}
|
||||
if (use_gui && playtree_iter){
|
||||
char* cwd;
|
||||
char cwd[MAXPATHLEN+2];
|
||||
// Remove Playtree and Playtree-Iter from memory as its not used by gui
|
||||
play_tree_iter_free(playtree_iter);
|
||||
playtree_iter=NULL;
|
||||
|
||||
if ((cwd=get_current_dir_name()))
|
||||
if (getcwd(cwd, MAXPATHLEN) != (char *)NULL)
|
||||
{
|
||||
cwd=(char*)realloc(cwd, strlen(cwd)+2);
|
||||
if (cwd)
|
||||
{
|
||||
strcat(cwd, "/");
|
||||
// Prefix relative paths with current working directory
|
||||
play_tree_add_bpf(playtree, cwd);
|
||||
free(cwd);
|
||||
}
|
||||
}
|
||||
// Import initital playtree into gui
|
||||
import_initial_playtree_into_gui(playtree, mconfig, enqueue);
|
||||
|
Loading…
Reference in New Issue
Block a user