[vlc-devel] commit: Check asprintf results. (Jean-Baptiste Kempf )
git version control
git at videolan.org
Wed Aug 13 02:15:48 CEST 2008
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue Aug 12 17:16:43 2008 -0700| [827bc36d28b5632711af17f83f6a5e35a2636e26] | committer: Jean-Baptiste Kempf
Check asprintf results.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=827bc36d28b5632711af17f83f6a5e35a2636e26
---
src/input/subtitles.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/input/subtitles.c b/src/input/subtitles.c
index 4361f80..0471c58 100644
--- a/src/input/subtitles.c
+++ b/src/input/subtitles.c
@@ -222,10 +222,12 @@ static char **paths_to_list( const char *psz_dir, char *psz_path )
if( *psz_subdir == '\0' )
continue;
- asprintf( &subdirs[i++], "%s%s%c",
+ if( asprintf( &subdirs[i++], "%s%s%c",
psz_subdir[0] == '.' ? psz_dir : "",
psz_subdir,
- psz_subdir[strlen(psz_subdir) - 1] == DIR_SEP_CHAR ? '\0' : DIR_SEP_CHAR );
+ psz_subdir[strlen(psz_subdir) - 1] == DIR_SEP_CHAR ?
+ '\0' : DIR_SEP_CHAR ) == -1 )
+ break;
}
subdirs[i] = NULL;
@@ -288,7 +290,8 @@ char **subtitles_Detect( input_thread_t *p_this, char *psz_path,
return NULL;
f_fname = strdup( psz_fname );
- asprintf( &f_dir, "%s%c", psz_cwd, DIR_SEP_CHAR );
+ if( asprintf( &f_dir, "%s%c", psz_cwd, DIR_SEP_CHAR ) == -1 )
+ f_dir = NULL; /* Assure that function will return in next test */
free( psz_cwd );
}
if( !f_fname || !f_dir )
More information about the vlc-devel
mailing list