Pass user events with custom data between threads

I know SDL_PushEvent could pass events between threads. And it useful for user events. But user data field contains fixed attrs (https://wiki.libsdl.org/SDL_UserEvent):

Uint32    type         value obtained from SDL_RegisterEvents()
Uint32    timestamp    timestamp of the event
Uint32    windowID     the associated window, if any
Sint32    code         user defined event code
void*     data1        user defined data pointer
void*     data2        user defined data pointer

But if I want to pass some more data (for example string-code of purchased product and few additional attrs) I dynamycally create custom object and put the address to data1 or data2.
And after checking event with PollEvent in the SDL_main function thread I delete this dinamycally created object.

What is the best way to pass custom data with events? What technique do you use?

As I’m coding in plain C, rather than new-fangled objects, I tend to pass a pointer to a global struct, which can hold anything you like. Small structs can be declared statically; large ones can be malloc’d and freed in the same way as the objects you describe.