mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-23 04:59:10 +00:00
Fix use after free when removing Windows audio device
This commit is contained in:
parent
59a104b803
commit
f1390780ca
2 changed files with 4 additions and 2 deletions
|
@ -396,10 +396,11 @@ WASAPI_RemoveDevice(const SDL_bool iscapture, LPCWSTR devid)
|
||||||
SDL_RemoveAudioDevice(iscapture, i->str);
|
SDL_RemoveAudioDevice(iscapture, i->str);
|
||||||
SDL_free(i->str);
|
SDL_free(i->str);
|
||||||
SDL_free(i);
|
SDL_free(i);
|
||||||
}
|
} else {
|
||||||
prev = i;
|
prev = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
WASAPI_AddDevice(const SDL_bool iscapture, const char *devname, WAVEFORMATEXTENSIBLE *fmt, LPCWSTR devid)
|
WASAPI_AddDevice(const SDL_bool iscapture, const char *devname, WAVEFORMATEXTENSIBLE *fmt, LPCWSTR devid)
|
||||||
|
|
|
@ -108,10 +108,11 @@ SDL_IMMDevice_Remove(const SDL_bool iscapture, LPCWSTR devid, SDL_bool useguid)
|
||||||
SDL_RemoveAudioDevice(iscapture, useguid ? ((void *) i->guid) : ((void *) i->str));
|
SDL_RemoveAudioDevice(iscapture, useguid ? ((void *) i->guid) : ((void *) i->str));
|
||||||
SDL_free(i->str);
|
SDL_free(i->str);
|
||||||
SDL_free(i);
|
SDL_free(i);
|
||||||
}
|
} else {
|
||||||
prev = i;
|
prev = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SDL_IMMDevice_Add(const SDL_bool iscapture, const char *devname, WAVEFORMATEXTENSIBLE *fmt, LPCWSTR devid, GUID *dsoundguid, SDL_bool useguid)
|
SDL_IMMDevice_Add(const SDL_bool iscapture, const char *devname, WAVEFORMATEXTENSIBLE *fmt, LPCWSTR devid, GUID *dsoundguid, SDL_bool useguid)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue