Correct fusd_destroy to lock and check before freeing.

This commit is contained in:
Godzil 2012-07-10 14:06:27 +02:00
parent fd1f2a7374
commit 9f496af46b

View File

@ -653,9 +653,22 @@ void fusd_destroy(struct fusd_file_info *file)
if (file == NULL) if (file == NULL)
return; return;
FILE_LOCK(file);
if (file->fusd_msg != NULL)
{
if (file->fusd_msg->data != NULL) if (file->fusd_msg->data != NULL)
{
free(file->fusd_msg->data); free(file->fusd_msg->data);
file->fusd_msg->data = NULL;
}
free(file->fusd_msg); free(file->fusd_msg);
file->fusd_msg = NULL;
}
FILE_UNLOCK(file);
pthread_mutex_destroy(&file->lock);
free(file); free(file);
} }