Sfoglia il codice sorgente

Fixed memory leak when out of memory

Sam Lantinga 2 anni fa
parent
commit
bac8df4abd
1 ha cambiato i file con 1 aggiunte e 0 eliminazioni
  1. 1 0
      src/joystick/linux/SDL_sysjoystick.c

+ 1 - 0
src/joystick/linux/SDL_sysjoystick.c

@@ -331,6 +331,7 @@ MaybeAddDevice(const char *path)
 
     item = (SDL_joylist_item *) SDL_calloc(1, sizeof (SDL_joylist_item));
     if (item == NULL) {
+        SDL_free(name);
         return -1;
     }