mirror of
https://github.com/falk-werner/webfuse-provider
synced 2026-03-02 04:09:18 +00:00
removed NULL-checks after malloc: they are not necessary, they were not consequently used and objects constructed by 3rd party libs are also unchecked
This commit is contained in:
@@ -11,13 +11,10 @@ struct wf_impl_authenticator * wf_impl_authenticator_create(
|
||||
void * user_data)
|
||||
{
|
||||
struct wf_impl_authenticator * authenticator = malloc(sizeof(struct wf_impl_authenticator));
|
||||
if (NULL != authenticator)
|
||||
{
|
||||
authenticator->type = strdup(type);
|
||||
authenticator->authenticate = authenticate;
|
||||
authenticator->user_data = user_data;
|
||||
authenticator->next = NULL;
|
||||
}
|
||||
authenticator->type = strdup(type);
|
||||
authenticator->authenticate = authenticate;
|
||||
authenticator->user_data = user_data;
|
||||
authenticator->next = NULL;
|
||||
|
||||
return authenticator;
|
||||
}
|
||||
|
||||
@@ -99,14 +99,11 @@ struct wf_impl_filesystem * wf_impl_filesystem_create(
|
||||
struct wf_mountpoint * mountpoint)
|
||||
{
|
||||
struct wf_impl_filesystem * filesystem = malloc(sizeof(struct wf_impl_filesystem));
|
||||
if (NULL != filesystem)
|
||||
bool success = wf_impl_filesystem_init(filesystem, session, name, mountpoint);
|
||||
if (!success)
|
||||
{
|
||||
bool success = wf_impl_filesystem_init(filesystem, session, name, mountpoint);
|
||||
if (!success)
|
||||
{
|
||||
free(filesystem);
|
||||
filesystem = NULL;
|
||||
}
|
||||
free(filesystem);
|
||||
filesystem = NULL;
|
||||
}
|
||||
|
||||
return filesystem;
|
||||
|
||||
@@ -20,7 +20,7 @@ static char * wf_impl_fill_buffer(
|
||||
*status = WF_GOOD;
|
||||
char * buffer = malloc(count);
|
||||
|
||||
if ((NULL != buffer) && (0 < count))
|
||||
if (0 < count)
|
||||
{
|
||||
if (0 == strcmp("identity", format))
|
||||
{
|
||||
|
||||
@@ -83,13 +83,10 @@ struct wf_server * wf_impl_server_create(
|
||||
if (wf_impl_mountpoint_factory_isvalid(&config->mountpoint_factory))
|
||||
{
|
||||
server = malloc(sizeof(struct wf_server));
|
||||
if (NULL != server)
|
||||
{
|
||||
wf_impl_server_protocol_init(&server->protocol, &config->mountpoint_factory);
|
||||
wf_impl_server_config_clone(config, &server->config);
|
||||
wf_impl_authenticators_move(&server->config.authenticators, &server->protocol.authenticators);
|
||||
server->context = wf_impl_server_context_create(server);
|
||||
}
|
||||
wf_impl_server_protocol_init(&server->protocol, &config->mountpoint_factory);
|
||||
wf_impl_server_config_clone(config, &server->config);
|
||||
wf_impl_authenticators_move(&server->config.authenticators, &server->protocol.authenticators);
|
||||
server->context = wf_impl_server_context_create(server);
|
||||
}
|
||||
|
||||
return server;
|
||||
|
||||
@@ -56,10 +56,7 @@ void wf_impl_server_config_clone(
|
||||
struct wf_server_config * wf_impl_server_config_create(void)
|
||||
{
|
||||
struct wf_server_config * config = malloc(sizeof(struct wf_server_config));
|
||||
if (NULL != config)
|
||||
{
|
||||
wf_impl_server_config_init(config);
|
||||
}
|
||||
wf_impl_server_config_init(config);
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -85,14 +85,11 @@ struct wf_server_protocol * wf_impl_server_protocol_create(
|
||||
void * create_mountpoint_context)
|
||||
{
|
||||
struct wf_server_protocol * protocol = malloc(sizeof(struct wf_server_protocol));
|
||||
if (NULL != protocol)
|
||||
{
|
||||
struct wf_impl_mountpoint_factory mountpoint_factory;
|
||||
wf_impl_mountpoint_factory_init(&mountpoint_factory,
|
||||
create_mountpoint, create_mountpoint_context);
|
||||
struct wf_impl_mountpoint_factory mountpoint_factory;
|
||||
wf_impl_mountpoint_factory_init(&mountpoint_factory,
|
||||
create_mountpoint, create_mountpoint_context);
|
||||
|
||||
wf_impl_server_protocol_init(protocol, &mountpoint_factory);
|
||||
}
|
||||
wf_impl_server_protocol_init(protocol, &mountpoint_factory);
|
||||
|
||||
return protocol;
|
||||
|
||||
|
||||
@@ -51,18 +51,15 @@ struct wf_impl_session * wf_impl_session_create(
|
||||
{
|
||||
|
||||
struct wf_impl_session * session = malloc(sizeof(struct wf_impl_session));
|
||||
if (NULL != session)
|
||||
{
|
||||
wf_slist_init(&session->filesystems);
|
||||
|
||||
session->wsi = wsi;
|
||||
session->is_authenticated = false;
|
||||
session->authenticators = authenticators;
|
||||
session->server = server;
|
||||
session->mountpoint_factory = mountpoint_factory;
|
||||
session->rpc = wf_jsonrpc_proxy_create(timer_manager, WF_DEFAULT_TIMEOUT, &wf_impl_session_send, session);
|
||||
wf_slist_init(&session->messages);
|
||||
}
|
||||
wf_slist_init(&session->filesystems);
|
||||
|
||||
session->wsi = wsi;
|
||||
session->is_authenticated = false;
|
||||
session->authenticators = authenticators;
|
||||
session->server = server;
|
||||
session->mountpoint_factory = mountpoint_factory;
|
||||
session->rpc = wf_jsonrpc_proxy_create(timer_manager, WF_DEFAULT_TIMEOUT, &wf_impl_session_send, session);
|
||||
wf_slist_init(&session->messages);
|
||||
|
||||
return session;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user