Changeset 10786 for trunk/dports/audio


Ignore:
Timestamp:
Feb 2, 2005, 9:04:40 AM (15 years ago)
Author:
toby
Message:

Fix a nasty memory leak.

Location:
trunk/dports/audio/libopendaap
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/audio/libopendaap/Portfile

    r10282 r10786  
    1 # $Id: Portfile,v 1.8 2005/01/08 13:59:10 toby Exp $
     1# $Id: Portfile,v 1.9 2005/02/02 09:04:40 toby Exp $
    22
    33PortSystem 1.0
    44name             libopendaap
    55version          0.3.0
    6 revision         2
     6revision         3
    77categories       audio
    88maintainers      toby@opendarwin.org
  • trunk/dports/audio/libopendaap/files/patch-http_client.c

    r10280 r10786  
    1 --- http_client.c.orig  Fri Dec 17 00:27:43 2004
    2 +++ http_client.c       Sat Jan  8 05:29:01 2005
     1--- http_client.c.orig  Wed Feb  2 03:52:25 2005
     2+++ http_client.c       Wed Feb  2 03:58:25 2005
    33@@ -50,6 +50,7 @@
    44 #include <stdio.h>
     
    99 #include "portability.h"
    1010 #include "thread.h"
     11@@ -502,6 +503,17 @@
     12 
     13 }
     14 
     15+void HTTP_FreeHeaders(HTTP_Header **headersList) {
     16+    HTTP_Header *cur, *next;
     17+
     18+    cur = *headersList;
     19+    while (cur) {
     20+        next = cur->next;
     21+        free(cur);
     22+        cur = next;
     23+    }
     24+}
     25+
     26 HTTP_GetResult *HTTP_Client_Get(HTTP_Connection *connection,
     27                                 const char *path,
     28                                 const char *hash,
     29@@ -537,6 +549,8 @@
     30     httpStatusCode = HTTP_PassStandardHeaders(headersList,
     31                                               &httpContentLength);
     32 
     33+    HTTP_FreeHeaders(&headersList);
     34+
     35     if (httpStatusCode == 401) /* unauthorized */
     36     {
     37         /* need a way to report it to the app */
     38@@ -630,6 +644,8 @@
     39 
     40     httpStatusCode = HTTP_PassStandardHeaders(headersList,
     41                                               &httpContentLength);
     42+
     43+    HTTP_FreeHeaders(&headersList);
     44 
     45     if (httpStatusCode != 200)
     46     {
Note: See TracChangeset for help on using the changeset viewer.