Fix various potential illegal access and memory leaks in error conditions.

This commit is contained in:
Justin Maggard
2014-04-07 11:20:19 -07:00
parent 6e43ab3c06
commit d492b43ef8
10 changed files with 34 additions and 21 deletions

View File

@ -44,7 +44,7 @@ insert_playlist(const char * path, char * name)
int items = 0, matches, ret;
char type[4];
strncpy(type, strrchr(name, '.')+1, 4);
strncpyt(type, strrchr(name, '.')+1, 4);
if( start_plist(path, NULL, &file, NULL, type) != 0 )
{
@ -109,7 +109,7 @@ gen_dir_hash(const char *path)
}
int
fill_playlists()
fill_playlists(void)
{
int rows, i, found, len;
char **result;
@ -138,7 +138,7 @@ fill_playlists()
last_dir = NULL;
last_hash = 0;
strncpy(type, strrchr(plpath, '.')+1, 4);
strncpyt(type, strrchr(plpath, '.')+1, 4);
if( start_plist(plpath, NULL, &file, NULL, type) != 0 )
continue;