01-10-2012 03:41 PM
Hi,
I just read the "Selling Digital Goods" recipe on the Blackberry Native SDK documentation website. I have one question. The code allocates memory for a purchase_params_t by calling malloc(). But there is no free() call anywhere in the sample code. Is the memory freed automatically by paymentservice_purchase()? Or is it the responsibility of the programmer to call free() (and the sample code just doesn't show it) ? Must purchase_params_t be allocated on the heap? Or can it go on the stack?
Thanks in advance!
01-10-2012 04:05 PM - edited 01-10-2012 04:07 PM
One more thing... the API reference shows the paymentservice_purchase() function as:
int paymentservice_purchase(purchase_params_t params, const char *group_id)
It looks like it takes a copy of a purchase_params_t object. But the sample code shows it as taking a pointer... I'm confused...
"Selling Digital Goods" Recipe link: https://bdsc.webapps.blackberry.com/native/documen
paymentservice_purchase() API Reference link: https://bdsc.webapps.blackberry.com/native/referen
01-10-2012 04:40 PM
According to headers params is not a pointer
int paymentservice_purchase(purchase_params_t params, const char *group_id)
01-10-2012 04:49 PM
Thanks BGmot!
@Blackberry/RIM, can you please update the sample code in the aforementioned recipe? It is showing incorrect usage of the payment API.
Thanks in advance.
01-10-2012 05:21 PM
btw - what is the philosophy behind passing purchase_params_t by value instead of by pointer or by constant reference?
01-11-2012 09:20 AM
Hi pbcoder,
Feel free to log this and any other found issues directly into our external bug tracking/feature request system:
This will let you track the progress of the fix.
Cheers,
01-11-2012 10:40 AM
Hi gbeukeboom,
Thanks for your reply. I've logged this into the Issue Tracker. If anyone wants to track its progress, you can find the issue here: