handling of blob_buf_free?

Nick vincent at systemli.org
Wed Oct 13 00:53:52 PDT 2021

As rule of thumb I would say:
- use struct blob_buf b = {0}; in the function as local variable
- free after using it
- use "struct ubus_context *ctx_local" in callback functions to 
differentiate between global ctx pointer and local callback variables

In the examples it is also freed. However, I would move the global 
definitions to local ones?


On 10/13/21 07:53, Nick wrote:
> Since I saw there were some new patches, e.g., procd, fixing 
> blob_buf_free() calls.
> I asked several months ago: "Should you call blob_buf_free() after 
> calling blob_buf_init()?"
> https://forum.openwrt.org/t/should-you-call-blob-buf-free-after-calling-blob-buf-init 
> I did not receive any answer. I think blob_buf_init() is freeing 
> memory if it is the same buf?
> Any suggestions how to use blob_buf_free?
> Bests
> Nick
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

More information about the openwrt-devel mailing list