mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-12-18 03:04:06 +00:00
config: Make config_alloc() no longer crash if allocation fails
This commit is contained in:
parent
7db28fad84
commit
007986974a
|
@ -35,6 +35,11 @@
|
||||||
config *config_alloc()
|
config *config_alloc()
|
||||||
{
|
{
|
||||||
config *cfg = (config *)malloc(sizeof(config));
|
config *cfg = (config *)malloc(sizeof(config));
|
||||||
|
if (!cfg) {
|
||||||
|
fprintf(stderr, "Failed to allocate a config object!\n");
|
||||||
|
return cfg;
|
||||||
|
}
|
||||||
|
|
||||||
memset(cfg, 0, sizeof(config));
|
memset(cfg, 0, sizeof(config));
|
||||||
return cfg;
|
return cfg;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue