1
0
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:
Falk Werner
2020-03-21 21:22:22 +01:00
parent 220df4ad50
commit 214d6b738d
22 changed files with 101 additions and 168 deletions

View File

@@ -12,13 +12,10 @@ extern struct wf_message * wf_message_create(json_t const * value)
{
char * data = malloc(sizeof(struct wf_message) + LWS_PRE + length);
message = (struct wf_message *) data;
if (NULL != message)
{
message->data = &data[sizeof(struct wf_message) + LWS_PRE];
message->length = length;
message->data = &data[sizeof(struct wf_message) + LWS_PRE];
message->length = length;
json_dumpb(value, message->data, length, JSON_COMPACT);
}
json_dumpb(value, message->data, length, JSON_COMPACT);
}
return message;

View File

@@ -16,18 +16,15 @@ char * wf_create_string(char const * format, ...)
if (0 <= needed)
{
result = malloc(needed + 1);
if (NULL != result)
{
va_list args;
va_start(args, format);
int count = vsnprintf(result, needed + 1, format, args);
va_end(args);
va_list args;
va_start(args, format);
int count = vsnprintf(result, needed + 1, format, args);
va_end(args);
if ((count < 0) || (needed < count))
{
free(result);
result = NULL;
}
if ((count < 0) || (needed < count))
{
free(result);
result = NULL;
}
}