Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[http] Add missing check for memory allocation failure
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Mar 21, 2017
1 parent 1ec2a60 commit f17cf0e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/net/tcp/httpconn.c
Expand Up @@ -277,6 +277,10 @@ int http_connect ( struct interface *xfer, struct uri *uri ) {

/* Allocate and initialise structure */
conn = zalloc ( sizeof ( *conn ) );
if ( ! conn ) {
rc = -ENOMEM;
goto err_alloc;
}
ref_init ( &conn->refcnt, http_conn_free );
conn->uri = uri_get ( uri );
conn->scheme = scheme;
Expand Down Expand Up @@ -310,5 +314,6 @@ int http_connect ( struct interface *xfer, struct uri *uri ) {
conn->scheme->name, conn->uri->host, port, strerror ( rc ) );
http_conn_close ( conn, rc );
ref_put ( &conn->refcnt );
err_alloc:
return rc;
}

0 comments on commit f17cf0e

Please sign in to comment.