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
76bbe6a6
Commit
76bbe6a6
authored
Oct 05, 2008
by
Rémi Duraffort
Committed by
Derk-Jan Hartman
Oct 06, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix resource leak when loadsave fail (CID 94)
parent
b27a312a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
src/playlist/loadsave.c
src/playlist/loadsave.c
+13
-9
No files found.
src/playlist/loadsave.c
View file @
76bbe6a6
...
@@ -51,14 +51,14 @@ int playlist_Export( playlist_t * p_playlist, const char *psz_filename ,
...
@@ -51,14 +51,14 @@ int playlist_Export( playlist_t * p_playlist, const char *psz_filename ,
p_export
=
(
playlist_export_t
*
)
malloc
(
sizeof
(
playlist_export_t
)
);
p_export
=
(
playlist_export_t
*
)
malloc
(
sizeof
(
playlist_export_t
)
);
if
(
!
p_export
)
if
(
!
p_export
)
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
p_export
->
psz_filename
=
NULL
;
p_export
->
psz_filename
=
psz_filename
?
strdup
(
psz_filename
)
:
NULL
;
if
(
psz_filename
)
p_export
->
psz_filename
=
strdup
(
psz_filename
);
p_export
->
p_file
=
utf8_fopen
(
psz_filename
,
"wt"
);
p_export
->
p_file
=
utf8_fopen
(
psz_filename
,
"wt"
);
if
(
!
p_export
->
p_file
)
if
(
!
p_export
->
p_file
)
{
{
msg_Err
(
p_playlist
,
"could not create playlist file %s (%m)"
,
msg_Err
(
p_playlist
,
"could not create playlist file %s (%m)"
,
psz_filename
);
psz_filename
);
free
(
p_export
->
psz_filename
);
free
(
p_export
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -69,23 +69,27 @@ int playlist_Export( playlist_t * p_playlist, const char *psz_filename ,
...
@@ -69,23 +69,27 @@ int playlist_Export( playlist_t * p_playlist, const char *psz_filename ,
p_playlist
->
p_private
=
(
void
*
)
p_export
;
p_playlist
->
p_private
=
(
void
*
)
p_export
;
/* And call the module ! All work is done now */
/* And call the module ! All work is done now */
p_module
=
module_Need
(
p_playlist
,
"playlist export"
,
psz_type
,
true
);
int
i_ret
;
p_module
=
module_need
(
p_playlist
,
"playlist export"
,
psz_type
,
true
);
if
(
!
p_module
)
if
(
!
p_module
)
{
{
msg_Warn
(
p_playlist
,
"exporting playlist failed"
);
msg_Warn
(
p_playlist
,
"exporting playlist failed"
);
vlc_object_unlock
(
p_playlist
);
i_ret
=
VLC_ENOOBJ
;
return
VLC_ENOOBJ
;
}
else
{
module_unneed
(
p_playlist
,
p_module
);
i_ret
=
VLC_SUCCESS
;
}
}
module_Unneed
(
p_playlist
,
p_module
);
/* Clean up */
/* Clean up */
fclose
(
p_export
->
p_file
);
fclose
(
p_export
->
p_file
);
free
(
p_export
->
psz_filename
);
free
(
p_export
->
psz_filename
);
free
(
p_export
);
free
(
p_export
);
p_playlist
->
p_private
=
NULL
;
p_playlist
->
p_private
=
NULL
;
vlc_object_unlock
(
p_playlist
);
vlc_object_unlock
(
p_playlist
);
return
VLC_SUCCESS
;
return
i_ret
;
}
}
/*****************************************************************************
/*****************************************************************************
...
...
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