all repos — mgba @ 07a3d08b26f7c26063ebd9a372aaacc40c2542f2

mGBA Game Boy Advance Emulator

Util: Fix a null-pointer issue when attempting to delete a key
Jeffrey Pfau jeffrey@endrift.com
Sat, 02 May 2015 01:08:29 -0700
commit

07a3d08b26f7c26063ebd9a372aaacc40c2542f2

parent

298b7e7a8b0a37fca2f55b4b859652cfd7762613

2 files changed, 9 insertions(+), 4 deletions(-)

jump to
M CHANGESCHANGES

@@ -42,6 +42,7 @@ - VFS: Fix resource leaks if some allocations fail

- Debugger: Fix boundary conditions in tab completion - Video: Fix an issue with very long filenames - SDL: Fix boundary conditions for joystick adjustments + - Util: Fix a null-pointer issue when attempting to delete a key Misc: - Qt: Show multiplayer numbers in window title - Qt: Handle saving input settings better
M src/util/configuration.csrc/util/configuration.c

@@ -53,10 +53,14 @@ void ConfigurationSetValue(struct Configuration* configuration, const char* section, const char* key, const char* value) {

struct Table* currentSection = &configuration->root; if (section) { currentSection = HashTableLookup(&configuration->sections, section); - if (!currentSection && value) { - currentSection = malloc(sizeof(*currentSection)); - HashTableInit(currentSection, 0, _sectionDeinit); - HashTableInsert(&configuration->sections, section, currentSection); + if (!currentSection) { + if (value) { + currentSection = malloc(sizeof(*currentSection)); + HashTableInit(currentSection, 0, _sectionDeinit); + HashTableInsert(&configuration->sections, section, currentSection); + } else { + return; + } } } if (value) {