Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
75799939
Commit
75799939
authored
Aug 24, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
timeshift: delete temporary file as soon as possible
This avoids leaking disk space if VLC does not terminate cleanly.
parent
0e7efd20
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
src/input/es_out_timeshift.c
src/input/es_out_timeshift.c
+16
-5
No files found.
src/input/es_out_timeshift.c
View file @
75799939
...
@@ -157,7 +157,9 @@ struct ts_storage_t
...
@@ -157,7 +157,9 @@ struct ts_storage_t
ts_storage_t
*
p_next
;
ts_storage_t
*
p_next
;
/* */
/* */
#ifdef _WIN32
char
*
psz_file
;
/* Filename */
char
*
psz_file
;
/* Filename */
#endif
size_t
i_file_max
;
/* Max size in bytes */
size_t
i_file_max
;
/* Max size in bytes */
int64_t
i_file_size
;
/* Current size in bytes */
int64_t
i_file_size
;
/* Current size in bytes */
FILE
*
p_filew
;
/* FILE handle for data writing */
FILE
*
p_filew
;
/* FILE handle for data writing */
...
@@ -1097,7 +1099,8 @@ static ts_storage_t *TsStorageNew( const char *psz_tmp_path, int64_t i_tmp_size_
...
@@ -1097,7 +1099,8 @@ static ts_storage_t *TsStorageNew( const char *psz_tmp_path, int64_t i_tmp_size_
if
(
unlikely
(
p_storage
==
NULL
)
)
if
(
unlikely
(
p_storage
==
NULL
)
)
return
NULL
;
return
NULL
;
int
fd
=
GetTmpFile
(
&
p_storage
->
psz_file
,
psz_tmp_path
);
char
*
psz_file
;
int
fd
=
GetTmpFile
(
&
psz_file
,
psz_tmp_path
);
if
(
fd
==
-
1
)
if
(
fd
==
-
1
)
{
{
free
(
p_storage
);
free
(
p_storage
);
...
@@ -1108,18 +1111,24 @@ static ts_storage_t *TsStorageNew( const char *psz_tmp_path, int64_t i_tmp_size_
...
@@ -1108,18 +1111,24 @@ static ts_storage_t *TsStorageNew( const char *psz_tmp_path, int64_t i_tmp_size_
if
(
p_storage
->
p_filew
==
NULL
)
if
(
p_storage
->
p_filew
==
NULL
)
{
{
close
(
fd
);
close
(
fd
);
vlc_unlink
(
p
_storage
->
p
sz_file
);
vlc_unlink
(
psz_file
);
goto
error
;
goto
error
;
}
}
p_storage
->
p_filer
=
vlc_fopen
(
p
_storage
->
p
sz_file
,
"rb"
);
p_storage
->
p_filer
=
vlc_fopen
(
psz_file
,
"rb"
);
if
(
p_storage
->
p_filer
==
NULL
)
if
(
p_storage
->
p_filer
==
NULL
)
{
{
fclose
(
p_storage
->
p_filew
);
fclose
(
p_storage
->
p_filew
);
vlc_unlink
(
p
_storage
->
p
sz_file
);
vlc_unlink
(
psz_file
);
goto
error
;
goto
error
;
}
}
#ifndef _WIN32
vlc_unlink
(
psz_file
);
free
(
psz_file
);
#else
p_storage
->
psz_file
=
psz_file
;
#endif
p_storage
->
p_next
=
NULL
;
p_storage
->
p_next
=
NULL
;
/* */
/* */
...
@@ -1140,7 +1149,7 @@ static ts_storage_t *TsStorageNew( const char *psz_tmp_path, int64_t i_tmp_size_
...
@@ -1140,7 +1149,7 @@ static ts_storage_t *TsStorageNew( const char *psz_tmp_path, int64_t i_tmp_size_
}
}
return
p_storage
;
return
p_storage
;
error:
error:
free
(
p
_storage
->
p
sz_file
);
free
(
psz_file
);
free
(
p_storage
);
free
(
p_storage
);
return
NULL
;
return
NULL
;
}
}
...
@@ -1159,8 +1168,10 @@ static void TsStorageDelete( ts_storage_t *p_storage )
...
@@ -1159,8 +1168,10 @@ static void TsStorageDelete( ts_storage_t *p_storage )
fclose
(
p_storage
->
p_filer
);
fclose
(
p_storage
->
p_filer
);
fclose
(
p_storage
->
p_filew
);
fclose
(
p_storage
->
p_filew
);
#ifdef _WIN32
vlc_unlink
(
p_storage
->
psz_file
);
vlc_unlink
(
p_storage
->
psz_file
);
free
(
p_storage
->
psz_file
);
free
(
p_storage
->
psz_file
);
#endif
free
(
p_storage
);
free
(
p_storage
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment