goto ERROR;
}
- // Allocate the full URL
- x->fullurl = curl_url();
- if (!x->fullurl) {
- r = -errno;
- goto ERROR;
- }
// Setup the xfer
r = pakfire_xfer_setup(x);
static int pakfire_xfer_prepare_url(struct pakfire_xfer* xfer) {
int r;
+ // If this has been called before, we free the former object
+ if (xfer->fullurl)
+ curl_url_cleanup(xfer->fullurl);
+
+ // Create a new URL object
+ xfer->fullurl = curl_url();
+ if (!xfer->fullurl) {
+ ERROR(xfer->ctx, "Could not allocate a new URL: %m\n");
+ r = -errno;
+ goto ERROR;
+ }
+
// Simply set absolute URLs
if (pakfire_string_is_url(xfer->url)) {
r = curl_url_set(xfer->fullurl, CURLUPART_URL, xfer->url, 0);