mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 15:17:01 +02:00
BUG/MINOR: compression: handle a possible strdup() failure
This defect was found by the coccinelle script "unchecked-strdup.cocci". It can be backported to all supported branches.
This commit is contained in:
parent
caf60ac696
commit
b4f965be9e
@ -116,12 +116,19 @@ int comp_append_type(struct comp_type **types, const char *type)
|
||||
|
||||
comp_type = calloc(1, sizeof(*comp_type));
|
||||
if (!comp_type)
|
||||
return 1;
|
||||
goto fail;
|
||||
comp_type->name_len = strlen(type);
|
||||
comp_type->name = strdup(type);
|
||||
if (!comp_type->name)
|
||||
goto fail_free_comp_type;
|
||||
comp_type->next = *types;
|
||||
*types = comp_type;
|
||||
return 0;
|
||||
|
||||
fail_free_comp_type:
|
||||
free(comp_type);
|
||||
fail:
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user