mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 19:24:06 +00:00
Fix leaking memory when --cqmfile given many times
Any previously allocated CQM file name was not freed when allocating memory for the new file name.
This commit is contained in:
parent
63a567ad8a
commit
6a178dee96
11
src/cfg.c
11
src/cfg.c
|
@ -658,8 +658,15 @@ int kvz_config_parse(kvz_config *cfg, const char *name, const char *value)
|
||||||
cfg->vui.chroma_loc = atoi(value);
|
cfg->vui.chroma_loc = atoi(value);
|
||||||
else if OPT("aud")
|
else if OPT("aud")
|
||||||
cfg->aud_enable = atobool(value);
|
cfg->aud_enable = atobool(value);
|
||||||
else if OPT("cqmfile")
|
else if OPT("cqmfile") {
|
||||||
cfg->cqmfile = strdup(value);
|
char* cqmfile = strdup(value);
|
||||||
|
if (!cqmfile) {
|
||||||
|
fprintf(stderr, "Failed to allocate memory for CQM file name.\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
FREE_POINTER(cfg->cqmfile);
|
||||||
|
cfg->cqmfile = cqmfile;
|
||||||
|
}
|
||||||
else if OPT("tiles-width-split") {
|
else if OPT("tiles-width-split") {
|
||||||
int retval = parse_tiles_specification(value, &cfg->tiles_width_count, &cfg->tiles_width_split);
|
int retval = parse_tiles_specification(value, &cfg->tiles_width_count, &cfg->tiles_width_split);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue