diff options
| author | Michael Brown | 2007-05-28 19:35:15 +0200 |
|---|---|---|
| committer | Michael Brown | 2007-05-28 19:35:15 +0200 |
| commit | 656485c1f1487775ccb0c223c4f5809f8daa7fcc (patch) | |
| tree | 045b8b6e395af9b8906ce30ed6c707f0d2310db1 /src/core | |
| parent | Move increment/decrement debug messages to DBG2 level (diff) | |
| download | ipxe-656485c1f1487775ccb0c223c4f5809f8daa7fcc.tar.gz ipxe-656485c1f1487775ccb0c223c4f5809f8daa7fcc.tar.xz ipxe-656485c1f1487775ccb0c223c4f5809f8daa7fcc.zip | |
Make URI structures reference-counted.
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/download.c | 4 | ||||
| -rw-r--r-- | src/core/open.c | 9 | ||||
| -rw-r--r-- | src/core/uri.c | 2 |
3 files changed, 9 insertions, 6 deletions
diff --git a/src/core/download.c b/src/core/download.c index 4522bf2c8..e3f77794f 100644 --- a/src/core/download.c +++ b/src/core/download.c @@ -121,7 +121,7 @@ int start_download ( const char *uri_string, struct async *parent, err: async_uninit ( &download->async ); ufree ( download->buffer.addr ); - free_uri ( download->uri ); + uri_put ( download->uri ); free ( download ); return rc; } @@ -150,7 +150,7 @@ static void download_sigchld ( struct async *async, /* Discard the buffer */ ufree ( download->buffer.addr ); } - free_uri ( download->uri ); + uri_put ( download->uri ); download->uri = NULL; /* Terminate ourselves */ diff --git a/src/core/open.c b/src/core/open.c index b61160eb2..6c184e653 100644 --- a/src/core/open.c +++ b/src/core/open.c @@ -52,6 +52,7 @@ static struct socket_opener socket_openers_end[0] int xfer_open_uri ( struct xfer_interface *xfer, const char *uri_string ) { struct uri *uri; struct uri_opener *opener; + int rc = -ENOTSUP; DBGC ( xfer, "XFER %p opening URI %s\n", xfer, uri_string ); @@ -61,14 +62,16 @@ int xfer_open_uri ( struct xfer_interface *xfer, const char *uri_string ) { for ( opener = uri_openers ; opener < uri_openers_end ; opener++ ) { if ( strcmp ( uri->scheme, opener->scheme ) == 0 ) { - return opener->open ( xfer, uri ); + rc = opener->open ( xfer, uri ); + goto done; } } DBGC ( xfer, "XFER %p attempted to open unsupported URI scheme " "\"%s\"\n", xfer, uri->scheme ); - free_uri ( uri ); - return -ENOTSUP; + done: + uri_put ( uri ); + return rc; } /** diff --git a/src/core/uri.c b/src/core/uri.c index cb1ac3bcb..6ebc63734 100644 --- a/src/core/uri.c +++ b/src/core/uri.c @@ -35,7 +35,7 @@ * * Splits a URI into its component parts. The return URI structure is * dynamically allocated and must eventually be freed by calling - * free_uri(). + * uri_put(). */ struct uri * parse_uri ( const char *uri_string ) { struct uri *uri; |
