|
@@ -277,6 +277,10 @@ int http_connect ( struct interface *xfer, struct uri *uri ) {
|
277
|
277
|
|
278
|
278
|
/* Allocate and initialise structure */
|
279
|
279
|
conn = zalloc ( sizeof ( *conn ) );
|
|
280
|
+ if ( ! conn ) {
|
|
281
|
+ rc = -ENOMEM;
|
|
282
|
+ goto err_alloc;
|
|
283
|
+ }
|
280
|
284
|
ref_init ( &conn->refcnt, http_conn_free );
|
281
|
285
|
conn->uri = uri_get ( uri );
|
282
|
286
|
conn->scheme = scheme;
|
|
@@ -310,5 +314,6 @@ int http_connect ( struct interface *xfer, struct uri *uri ) {
|
310
|
314
|
conn->scheme->name, conn->uri->host, port, strerror ( rc ) );
|
311
|
315
|
http_conn_close ( conn, rc );
|
312
|
316
|
ref_put ( &conn->refcnt );
|
|
317
|
+ err_alloc:
|
313
|
318
|
return rc;
|
314
|
319
|
}
|