mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-24 02:24:07 +00:00
Merge pull request #22 from lfasnacht/realloc_fix
Use realloc correctly
This commit is contained in:
commit
5bebb34787
|
@ -147,9 +147,11 @@ int main(int argc, char *argv[])
|
||||||
sprintf(dim_str, "_%dx%d.yuv", cfg->width, cfg->height);
|
sprintf(dim_str, "_%dx%d.yuv", cfg->width, cfg->height);
|
||||||
left_len = strlen(cfg->debug);
|
left_len = strlen(cfg->debug);
|
||||||
right_len = strlen(dim_str);
|
right_len = strlen(dim_str);
|
||||||
if (realloc(cfg->debug, left_len + right_len + 1)) {
|
if (!(cfg->debug = realloc(cfg->debug, left_len + right_len + 1))) {
|
||||||
strcpy(cfg->debug + left_len, dim_str);
|
fprintf(stderr, "realloc failed!\n");
|
||||||
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
strcpy(cfg->debug + left_len, dim_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do more validation to make sure the parameters we have make sense.
|
// Do more validation to make sure the parameters we have make sense.
|
||||||
|
|
Loading…
Reference in a new issue