How to tell if dcraw_make_mem_image() was called?

Hi comrads,

I would like to know how i can know that this call has happened:
image = iProcessor.dcraw_make_mem_image(&rc);

The reason is that i need to clear 'image':
LibRaw::dcraw_clear_mem(image);

But ofcourse only when dcraw_make_mem_image has been called. However, i have no idea to tell *if* it has been called in the first place. For example, testing for iProcessor.data!=NULL or image == NULL or .data or something similar has not worked for me, please assist.

Forums: 

I do not understand your

I do not understand your question.

If dcraw_make_mem_image() fails, it will return NULL.
Also, if you pass NULL to dcraw_clear_mem, it will do nothing.

So, what is the *real* problem?

-- Alex Tutubalin @LibRaw LLC

(A) = CORRECT WAY =

(A) = CORRECT WAY =
libraw_processed_image_t* image;
image = iProcessor.dcraw_make_mem_image(&rc);
LibRaw::dcraw_clear_mem(image);

(B) = ERROR =
libraw_processed_image_t* image;
LibRaw::dcraw_clear_mem(image);

How can i know if i have used the (A) or (B) approach to initialize image?

Case B: initialize the image

Case B: initialize the image variable:

libraw_processed_image_t* image = NULL;
LibRaw::dcraw_clear_mem(image);

Without initialization, you pass random garbage to dcraw_clear_mem()

-- Alex Tutubalin @LibRaw LLC