mirror of
https://github.com/owntone/owntone-server.git
synced 2025-02-04 02:16:01 -05:00
Fix deadlock in updating playlists
This commit is contained in:
parent
b02eed1195
commit
10b5d73ca0
18
src/db-sql.c
18
src/db-sql.c
@ -1544,22 +1544,18 @@ M3UFILE *db_sql_fetch_playlist(char **pe, char *path, int index) {
|
|||||||
M3UFILE *pm3u=NULL;
|
M3UFILE *pm3u=NULL;
|
||||||
SQL_ROW row;
|
SQL_ROW row;
|
||||||
|
|
||||||
result = db_sql_enum_begin_fn(pe,"select * from playlists where "
|
|
||||||
|
result = db_sql_fetch_row(pe, &row, "select * from playlists where "
|
||||||
"path='%q' and idx=%d",path,index);
|
"path='%q' and idx=%d",path,index);
|
||||||
|
|
||||||
if(result != DB_E_SUCCESS)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
result = db_sql_enum_fetch_fn(pe, &row);
|
|
||||||
if(result != DB_E_SUCCESS) {
|
if(result != DB_E_SUCCESS) {
|
||||||
db_sql_enum_end_fn(NULL);
|
if(result == DB_E_NOROWS) {
|
||||||
|
if(pe) { free(*pe); };
|
||||||
|
db_get_error(pe,DB_E_INVALID_PLAYLIST);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!row) {
|
return NULL; /* sql error or something */
|
||||||
db_sql_enum_end_fn(NULL);
|
|
||||||
db_get_error(pe,DB_E_INVALID_PLAYLIST);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pm3u=(M3UFILE*)malloc(sizeof(M3UFILE));
|
pm3u=(M3UFILE*)malloc(sizeof(M3UFILE));
|
||||||
@ -1567,13 +1563,13 @@ M3UFILE *db_sql_fetch_playlist(char **pe, char *path, int index) {
|
|||||||
DPRINTF(E_FATAL,L_MISC,"malloc error: db_sql_fetch_playlist\n");
|
DPRINTF(E_FATAL,L_MISC,"malloc error: db_sql_fetch_playlist\n");
|
||||||
|
|
||||||
db_sql_build_m3ufile(row,pm3u);
|
db_sql_build_m3ufile(row,pm3u);
|
||||||
|
db_sql_dispose_row();
|
||||||
|
|
||||||
if((db_sql_in_playlist_scan) && (!db_sql_reload)) {
|
if((db_sql_in_playlist_scan) && (!db_sql_reload)) {
|
||||||
db_sql_exec_fn(NULL,E_FATAL,"insert into plupdated values (%d)",
|
db_sql_exec_fn(NULL,E_FATAL,"insert into plupdated values (%d)",
|
||||||
pm3u->id);
|
pm3u->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
db_sql_enum_end_fn(NULL);
|
|
||||||
return pm3u;
|
return pm3u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user