mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-12-17 19:04:05 +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 *cfg = (config *)malloc(sizeof(config));
|
||||
if (!cfg) {
|
||||
fprintf(stderr, "Failed to allocate a config object!\n");
|
||||
return cfg;
|
||||
}
|
||||
|
||||
memset(cfg, 0, sizeof(config));
|
||||
return cfg;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue