[mt-daapd] Fix incorrect return value in ws_addarg [I hope I have the right email address for this patch - I couldn't find any reference to a devel list, and I found your email in the firefly forums - jk] When I click on the 'scan' button on the mt-daapd admin site, the mt-daapd process aborts, with an out-of-memory error. Here's the log with webserver debugging enabled: Thread 12: Request: POST /xml-rpc HTTP/1.1 Thread 12: Read: User-Agent: Mozilla/5.0 (compatible; Konqueror/3.5; Linux 2.6.25-rc7-p2; X11; ppc) KHTML/3.5.9 (like Gecko) (Kubuntu package 4:3.5.9-0ubuntu5) Thread 12: Adding header *User-Agent=Mozilla/5.0 (compatible; Konqueror/3.5; Linux 2.6.25-rc7-p2; X11; ppc) KHTML/3.5.9 (like Gecko) (Kubuntu package 4:3.5.9-0ubuntu5)* Added *User-Agent=Mozilla/5.0 (compatible; Konqueror/3.5; Linux 2.6.25-rc7-p2; X11; ppc) KHTML/3.5.9 (like Gecko) (Kubuntu package 4:3.5.9-0ubuntu5)* Thread 12: Read: Referer: http://pokey:3689/index.html Thread 12: Adding header *Referer=http://pokey:3689/index.html* Added *Referer=http://pokey:3689/index.html* Thread 12: Read: Pragma: no-cache Thread 12: Adding header *Pragma=no-cache* Added *Pragma=no-cache* Thread 12: Read: Cache-control: no-cache Thread 12: Adding header *Cache-control=no-cache* Added *Cache-control=no-cache* Thread 12: Read: Accept: text/html, image/jpeg, image/png, text/*, image/*, */* Thread 12: Adding header *Accept=text/html, image/jpeg, image/png, text/*, image/*, */** Added *Accept=text/html, image/jpeg, image/png, text/*, image/*, */** Thread 12: Read: Accept-Encoding: x-gzip, x-deflate, gzip, deflate Thread 12: Adding header *Accept-Encoding=x-gzip, x-deflate, gzip, deflate* Added *Accept-Encoding=x-gzip, x-deflate, gzip, deflate* Thread 12: Read: Accept-Charset: utf-8, utf-8;q=0.5, *;q=0.5 Thread 12: Adding header *Accept-Charset=utf-8, utf-8;q=0.5, *;q=0.5* Added *Accept-Charset=utf-8, utf-8;q=0.5, *;q=0.5* Thread 12: Read: Accept-Language: en Thread 12: Adding header *Accept-Language=en* Added *Accept-Language=en* Thread 12: Read: Host: pokey:3689 Thread 12: Adding header *Host=pokey:3689* Added *Host=pokey:3689* Thread 12: Read: connection: close Thread 12: Adding header *connection=close* Added *connection=close* Thread 12: Read: x-prototype-version: 1.4.0 Thread 12: Adding header *x-prototype-version=1.4.0* Added *x-prototype-version=1.4.0* Thread 12: Read: x-requested-with: XMLHttpRequest Thread 12: Adding header *x-requested-with=XMLHttpRequest* Added *x-requested-with=XMLHttpRequest* Thread 12: Read: Content-type: application/x-www-form-urlencoded Thread 12: Adding header *Content-type=application/x-www-form-urlencoded* Added *Content-type=application/x-www-form-urlencoded* Thread 12: Read: Authorization: Basic YWRtaW46ZGVhbDlwcmljeQ== Thread 12: Adding header *Authorization=Basic YWRtaW46ZGVhbDlwcmljeQ==* Added *Authorization=Basic YWRtaW46ZGVhbDlwcmljeQ==* Thread 12: Read: Connection: Keep-Alive Thread 12: Adding header *Connection=Keep-Alive* Updating Connection from close to Keep-Alive Thread 12: Out of memory Aborting Rendezvous socket closed (daap server crashed?) Aborting. Aborting It looks like my browser is sending two 'Connection' headers, one in all-lowercase. This causes the 'update' case in ws_addarg, which then returns the wrong value (0 instead of TRUE). The caller assumes that we're out of memory, as ws_addarg has returned FALSE, so the process exits. Signed-off-by: Jeremy Kerr Index: mt-daapd-0.9~r1696/src/webserver.c =================================================================== --- mt-daapd-0.9~r1696.orig/src/webserver.c +++ mt-daapd-0.9~r1696/src/webserver.c @@ -1514,7 +1514,7 @@ int ws_addarg(ARGLIST *root, char *key, free(newkey); free(pnew); WS_EXIT(); - return 0; + return TRUE; } current=current->next; }