mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
BUG/MINOR: hlua: fixing ambiguous sizeof in hlua_load_per_thread
As pointed out by chipitsine in GH #1879, coverity complains about a sizeof with char ** type where it should be char *. This was introduced in 'MINOR: hlua: Allow argument on lua-lod(-per-thread) directives' (ae6b568) Luckily this had no effect so far because on most platforms sizeof(char **) == sizeof(char *), but this can not be safely assumed for portability reasons. The fix simply changes the argument to sizeof so that it refers to '*per_thread_load[len]' instead of 'per_thread_load[len]'. No backport needed.
This commit is contained in:
parent
ec059c249e
commit
b12d169ea3
@ -11335,7 +11335,7 @@ static int hlua_load_per_thread(char **args, int section_type, struct proxy *cur
|
|||||||
|
|
||||||
/* count args excepting the first, allocate array and copy args */
|
/* count args excepting the first, allocate array and copy args */
|
||||||
for (i = 0; *(args[i + 1]) != 0; i++);
|
for (i = 0; *(args[i + 1]) != 0; i++);
|
||||||
per_thread_load[len] = calloc(i + 1, sizeof(per_thread_load[len]));
|
per_thread_load[len] = calloc(i + 1, sizeof(*per_thread_load[len]));
|
||||||
if (per_thread_load[len] == NULL) {
|
if (per_thread_load[len] == NULL) {
|
||||||
memprintf(err, "out of memory error");
|
memprintf(err, "out of memory error");
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user