util/xmlconfig: fix memory leak triggered by duplicates
This change copies the string once.
Direct leak of 196 byte(s) in 14 object(s) allocated from:
#0 0x7f71598ec7a7 in strdup (/usr/lib64/libasan.so.6+0x5c7a7)
#1 0x7f70a56ff942 in driParseOptionInfo ../src/util/xmlconfig.c:357
#2 0x7f70a56f0565 in pipe_loader_load_options ../src/gallium/auxiliary/pipe-loader/pipe_loader.c:126
#3 0x7f70a56f0565 in pipe_loader_create_screen_vk ../src/gallium/auxiliary/pipe-loader/pipe_loader.c:167
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20026>
This commit is contained in:
parent
f603d8ce9e
commit
2b2824b9ea
1 changed files with 2 additions and 1 deletions
|
|
@ -350,11 +350,12 @@ driParseOptionInfo(driOptionCache *info,
|
|||
if (optinfo->name) {
|
||||
/* Duplicate options override the value, but the type must match. */
|
||||
assert(optinfo->type == opt->info.type);
|
||||
} else {
|
||||
XSTRDUP(optinfo->name, name);
|
||||
}
|
||||
|
||||
optinfo->type = opt->info.type;
|
||||
optinfo->range = opt->info.range;
|
||||
XSTRDUP(optinfo->name, name);
|
||||
|
||||
switch (opt->info.type) {
|
||||
case DRI_BOOL:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue