Re: [PATCH 00/55] Hyper-V: code cleanup & prep for future changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Jan 22, 2021, at 11:30 AM, Laine Stump <laine@xxxxxxxxxx> wrote:
> 
> On 1/22/21 11:05 AM, Laine Stump wrote:
>> 1) There are several cleanup functions in external libraries that in the past were only called after checking that the pointer was != NULL. g_autoptr cleanups need to handle being called with NULL as a NOP, and I'm concerned that these functions may not behave properly in that case. Can you either verify that it's safe to call them with NULL, or provide a wrapper function that checks for NULL and use that as the cleanup?
> 
> I asked about item (2) on IRC just now, and danpb produced a short example program that proves it is okay to use values from auto-freed objects as the return value of a function. So there is only question (1) left. Let me know and I'll either push or wait for modified patches accordingly.

For WsXmlDocH, GLib's documentation says that 
G_DEFINE_AUTOPTR_CLEANUP_FUNC() is NULL-safe:
> The function will not be called if the variable to be cleaned up contains NULL.

https://developer.gnome.org/glib/stable/glib-Miscellaneous-Macros.html#G-DEFINE-AUTOPTR-CLEANUP-FUNC:CAPS

For client_opt_t and filter_t, the third parameter to 
G_DEFINE_AUTO_CLEANUP_FREE_FUNC() was used to prevent the types' free 
functions from being called if they're NULL.

-- 
Matt





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux