Don't do NULL-checks before SDL_free()

Replaces the pattern

  if (ptr) {
    SDL_free(ptr);
  }

with

  SDL_free(ptr);
This commit is contained in:
Eddy Jansson
2025-10-19 11:07:48 +02:00
committed by Sam Lantinga
parent 2f810e0a5f
commit aaee09d6ed
40 changed files with 76 additions and 229 deletions

View File

@@ -534,9 +534,7 @@ void SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *state)
if (state->key_maps && state->key_maps != default_key_maps) {
int i;
for (i = 0; i < MAX_NR_KEYMAPS; ++i) {
if (state->key_maps[i]) {
SDL_free(state->key_maps[i]);
}
SDL_free(state->key_maps[i]);
}
SDL_free(state->key_maps);
}

View File

@@ -563,9 +563,7 @@ bool SDL_IBus_Init(void)
return false;
}
if (ibus_addr_file) {
SDL_free(ibus_addr_file);
}
SDL_free(ibus_addr_file);
ibus_addr_file = SDL_strdup(addr_file);
if (inotify_fd < 0) {