mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-14 08:15:02 -05:00
Fix for out of stack space on large music libraries
This commit is contained in:
parent
2dee0cebd4
commit
8ef12d52f6
@ -239,9 +239,7 @@ DAAP_BLOCK *daap_add_empty(DAAP_BLOCK *parent, char *tag) {
|
|||||||
int daap_serialize(DAAP_BLOCK *root, int fd, int gzip) {
|
int daap_serialize(DAAP_BLOCK *root, int fd, int gzip) {
|
||||||
char size[4];
|
char size[4];
|
||||||
|
|
||||||
if(!root)
|
while(root) {
|
||||||
return 0;
|
|
||||||
|
|
||||||
r_write(fd,root->tag,4);
|
r_write(fd,root->tag,4);
|
||||||
|
|
||||||
size[0] = (root->reported_size >> 24) & 0xFF;
|
size[0] = (root->reported_size >> 24) & 0xFF;
|
||||||
@ -263,8 +261,8 @@ int daap_serialize(DAAP_BLOCK *root, int fd, int gzip) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(daap_serialize(root->next,fd,gzip))
|
root=root->next;
|
||||||
return -1;
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -275,9 +273,9 @@ int daap_serialize(DAAP_BLOCK *root, int fd, int gzip) {
|
|||||||
* Free an entire daap formatted block
|
* Free an entire daap formatted block
|
||||||
*/
|
*/
|
||||||
void daap_free(DAAP_BLOCK *root) {
|
void daap_free(DAAP_BLOCK *root) {
|
||||||
if(!root)
|
DAAP_BLOCK *pnext;
|
||||||
return;
|
|
||||||
|
|
||||||
|
while(root) {
|
||||||
DPRINTF(ERR_DEBUG,"Freeing %c%c%c%c\n",root->tag[0],root->tag[1],
|
DPRINTF(ERR_DEBUG,"Freeing %c%c%c%c\n",root->tag[0],root->tag[1],
|
||||||
root->tag[2],root->tag[3]);
|
root->tag[2],root->tag[3]);
|
||||||
|
|
||||||
@ -285,7 +283,10 @@ void daap_free(DAAP_BLOCK *root) {
|
|||||||
free(root->value); /* otherwise, static value */
|
free(root->value); /* otherwise, static value */
|
||||||
|
|
||||||
daap_free(root->children);
|
daap_free(root->children);
|
||||||
daap_free(root->next);
|
|
||||||
|
pnext=root->next;
|
||||||
free(root);
|
free(root);
|
||||||
|
root=pnext;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -465,6 +465,9 @@ void *signal_handler(void *arg) {
|
|||||||
DPRINTF(ERR_LOG,"Got HUP signal. Notifying daap server.\n");
|
DPRINTF(ERR_LOG,"Got HUP signal. Notifying daap server.\n");
|
||||||
config.reload=1;
|
config.reload=1;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
DPRINTF(ERR_LOG,"What am I doing here?\n");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -649,7 +652,7 @@ int main(int argc, char *argv[]) {
|
|||||||
config.reload=0;
|
config.reload=0;
|
||||||
DPRINTF(ERR_LOG,"Reloading configuration\n");
|
DPRINTF(ERR_LOG,"Reloading configuration\n");
|
||||||
}
|
}
|
||||||
sleep(10);
|
sleep(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINTF(ERR_LOG,"Stopping gracefully\n");
|
DPRINTF(ERR_LOG,"Stopping gracefully\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user