1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-19 13:03:11 +01:00

Replace malloc(0) with explicit NULL

From documentation on `void* malloc( size_t size );`:
> If size is zero, the behavior is implementation defined (null pointer
may be returned, or some non-null pointer may be returned that may not
be used to access storage).

Both `free()` and `realloc()` understand `NULL`, so use that to avoid
implementation-defined behaviour
This commit is contained in:
Michał Janiszewski
2016-11-06 21:00:47 +01:00
committed by GitHub
parent fe3b15c2f1
commit 06b659db40
2 changed files with 5 additions and 5 deletions

View File

@@ -95,8 +95,8 @@ void title_sequence_create_preset(const char *name)
safe_strcpy(gConfigTitleSequences.presets[preset].name, name, TITLE_SEQUENCE_NAME_SIZE);
gConfigTitleSequences.presets[preset].path[0] = 0;
gConfigTitleSequences.presets[preset].saves = malloc(0);
gConfigTitleSequences.presets[preset].commands = malloc(0);
gConfigTitleSequences.presets[preset].saves = NULL;
gConfigTitleSequences.presets[preset].commands = NULL;
gConfigTitleSequences.presets[preset].num_saves = 0;
gConfigTitleSequences.presets[preset].num_commands = 0;