Fix memory leak on error

The variable condition was not destroyed on strdup() failure.
This commit is contained in:
Romain Vimont 2019-05-29 21:33:34 +02:00
parent e1afd9f8b0
commit 507b0bcccf
1 changed files with 1 additions and 0 deletions

View File

@ -100,6 +100,7 @@ file_handler_init(struct file_handler *file_handler, const char *serial) {
file_handler->serial = SDL_strdup(serial); file_handler->serial = SDL_strdup(serial);
if (!file_handler->serial) { if (!file_handler->serial) {
LOGW("Cannot strdup serial"); LOGW("Cannot strdup serial");
SDL_DestroyCond(file_handler->event_cond);
SDL_DestroyMutex(file_handler->mutex); SDL_DestroyMutex(file_handler->mutex);
return false; return false;
} }