mirror of
https://gitlab.xiph.org/xiph/ezstream.git
synced 2024-12-04 14:46:31 -05:00
Fix playlist_free() as well ...
git-svn-id: https://svn.xiph.org/trunk/ezstream@12685 0101bb08-14d6-0310-b084-bc0e0c8e3800
This commit is contained in:
parent
3cd7528b07
commit
84bf642a1e
@ -1033,7 +1033,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
shout_close(shout);
|
shout_close(shout);
|
||||||
|
|
||||||
playlist_free(playlist);
|
playlist_free(&playlist);
|
||||||
playlist_shutdown();
|
playlist_shutdown();
|
||||||
|
|
||||||
shout_shutdown();
|
shout_shutdown();
|
||||||
|
@ -141,7 +141,7 @@ playlist_read(const char *filename)
|
|||||||
|
|
||||||
if ((filep = fopen(filename, "r")) == NULL) {
|
if ((filep = fopen(filename, "r")) == NULL) {
|
||||||
printf("%s: %s: %s\n", __progname, filename, strerror(errno));
|
printf("%s: %s: %s\n", __progname, filename, strerror(errno));
|
||||||
playlist_free(pl);
|
playlist_free(&pl);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ playlist_read(const char *filename)
|
|||||||
/* We got one. */
|
/* We got one. */
|
||||||
if (!playlist_add(pl, buf)) {
|
if (!playlist_add(pl, buf)) {
|
||||||
fclose(filep);
|
fclose(filep);
|
||||||
playlist_free(pl);
|
playlist_free(&pl);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -191,7 +191,7 @@ playlist_read(const char *filename)
|
|||||||
printf("%s: playlist_read(): Error while reading %s: %s\n",
|
printf("%s: playlist_read(): Error while reading %s: %s\n",
|
||||||
__progname, filename, strerror(errno));
|
__progname, filename, strerror(errno));
|
||||||
fclose(filep);
|
fclose(filep);
|
||||||
playlist_free(pl);
|
playlist_free(&pl);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,18 +215,18 @@ playlist_program(const char *filename)
|
|||||||
#ifdef HAVE_STAT
|
#ifdef HAVE_STAT
|
||||||
if (stat(filename, &st) == -1) {
|
if (stat(filename, &st) == -1) {
|
||||||
printf("%s: %s: %s\n", __progname, filename, strerror(errno));
|
printf("%s: %s: %s\n", __progname, filename, strerror(errno));
|
||||||
playlist_free(pl);
|
playlist_free(&pl);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
if (!(st.st_mode & (S_IEXEC | S_IXGRP | S_IXOTH))) {
|
if (!(st.st_mode & (S_IEXEC | S_IXGRP | S_IXOTH))) {
|
||||||
printf("%s: %s: Not an executable program\n", __progname, filename);
|
printf("%s: %s: Not an executable program\n", __progname, filename);
|
||||||
playlist_free(pl);
|
playlist_free(&pl);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if ((filep = fopen(filename, "r")) == NULL) {
|
if ((filep = fopen(filename, "r")) == NULL) {
|
||||||
printf("%s: %s: %s\n", __progname, filename, strerror(errno));
|
printf("%s: %s: %s\n", __progname, filename, strerror(errno));
|
||||||
playlist_free(pl);
|
playlist_free(&pl);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
fclose(filep);
|
fclose(filep);
|
||||||
@ -236,32 +236,36 @@ playlist_program(const char *filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
playlist_free(playlist_t *pl)
|
playlist_free(playlist_t **pl)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
playlist_t *tmp;
|
||||||
|
|
||||||
if (pl != NULL) {
|
if (pl == NULL || *pl == NULL)
|
||||||
if (pl->filename != NULL)
|
return;
|
||||||
xfree(pl->filename);
|
|
||||||
|
|
||||||
if (pl->list != NULL) {
|
tmp = *pl;
|
||||||
if (pl->size > 0) {
|
|
||||||
for (i = 0; i < pl->size / sizeof(char *); i++) {
|
if (tmp->filename != NULL)
|
||||||
if (pl->list[i] != NULL)
|
xfree(tmp->filename);
|
||||||
xfree(pl->list[i]);
|
|
||||||
else
|
if (tmp->list != NULL) {
|
||||||
break;
|
if (tmp->size > 0) {
|
||||||
}
|
for (i = 0; i < tmp->size / sizeof(char *); i++) {
|
||||||
|
if (tmp->list[i] != NULL)
|
||||||
|
xfree(tmp->list[i]);
|
||||||
|
else
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
xfree(pl->list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pl->prog_track != NULL)
|
xfree(tmp->list);
|
||||||
xfree(pl->prog_track);
|
|
||||||
|
|
||||||
xfree(pl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tmp->prog_track != NULL)
|
||||||
|
xfree(tmp->prog_track);
|
||||||
|
|
||||||
|
xfree(pl);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
@ -415,7 +419,7 @@ playlist_reread(playlist_t **plist)
|
|||||||
if ((new_pl = playlist_read(pl->filename)) == NULL)
|
if ((new_pl = playlist_read(pl->filename)) == NULL)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
playlist_free(pl);
|
playlist_free(&pl);
|
||||||
*plist = new_pl;
|
*plist = new_pl;
|
||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
|
@ -47,7 +47,7 @@ playlist_t * playlist_program(const char * /* program name */);
|
|||||||
* Free all memory used by a playlist handler that was created with
|
* Free all memory used by a playlist handler that was created with
|
||||||
* playlist_read().
|
* playlist_read().
|
||||||
*/
|
*/
|
||||||
void playlist_free(playlist_t *);
|
void playlist_free(playlist_t **);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the next item in the playlist. Returns a NUL-terminated string of a
|
* Get the next item in the playlist. Returns a NUL-terminated string of a
|
||||||
|
Loading…
Reference in New Issue
Block a user