Q:

C++ struct is destruct after the function returns

A bitmap struct I translate in another function is set to NULL after the function returns
the function :

HRESULT RessourcesLoader::decode(LPCWSTR name,ID2D1Bitmap* bitmap1) {
    int hr = S_OK;
    hr = LoadFile(name, bitmap1);
    assert(SUCCEEDED(hr));

    hr = rendertarget->CreateBitmapFromWicBitmap(wicConverter, NULL, &bitmap1);
    assert(SUCCEEDED(hr));

return hr;

called here :

ID2D1Bitmap* bmp1=NULL;
ID2D1Bitmap* bmp2=NULL;

rl->decode(L"Menu_corner.png", bmp1);

rl->decode(L"Menu_side.png", bmp2);

(inside the function hr is S_OK and the struct have all in it, once the function return the pointers are NULL)
is it a scope issue ?

A:

Remember that C++ parameters like ID2D1Bitmap* bitmap1 are passed by value.  That means you have two completely separate (and almost unrelated) variables bmp1 and bitmap1.  The only relationship the two variables have is that bitmap1 starts life with the same value that bmp1 had when decode was called - i.e., NULL.
Your decode logic calls CreateBitmapFromWicBitmap passing in the address of bitmap1and CreateBitmapFromWicBitmap carefully fills bitmap1 with the address of the newly created bitmap.  But that doesn't affect bmp1 at all.  So bmp1 remains set to null.  You can check this for yourself by placing a breakpoint on return hr and then looking at the contents of bmp1 and bitmap1.
If you want Decode to change the contents of bmp1 you need to pass the address of bmp1 to decode not the contents.  That means bitmap1 should be type ID2D1Bitmap ** and decode should be called like this... rl->decode(L"Menu_corner.png", &bmp1);
Update
Several comments pointed out that I was rather careless in saying "C++ parameters are passed by value", I've reworded the text above to be more focused.  
The comments also point out that that C++ parameters can be passed by reference as well as by value.  In the case of the decode function by using the syntax ID2D1Bitmap*& bitmap1.
I have to confess I'm somewhat ambivalent about the relative merits of ID2D1Bitmap** bitmap1 and ID2D1Bitmap*& bitmap1.  But that may say more about my personal biases than about anything else.

