[Spice-devel] [spice-common v3 3/7] log: Add test case for logging code

Christophe Fergeau cfergeau at redhat.com
Thu Jan 21 02:20:41 PST 2016


On Fri, Dec 18, 2015 at 11:40:51AM +0100, Christophe Fergeau wrote:
> On Thu, Dec 17, 2015 at 10:43:05PM +0100, Victor Toso wrote:
> > > +/* Checks that g_return_if_fail() does not abort by default */
> > > +static void test_spice_non_fatal_g_return_if_fail(void)
> > > +{
> > > +    char *pattern = g_strconcat ("*", G_STRFUNC, "*", NULL);
> > > +    g_test_log_set_fatal_handler(non_fatal_warnings_criticals, pattern);
> > > +
> > > +    if (g_test_subprocess()) {
> > > +        g_return_if_fail(FALSE);
> > 
> > pattern leaks here
> 
> I know, but I don't think I can easily free it unless I move the
> g_return_if_fail() to a separate helper function.

For the record, the leak could probably be handled with
g_test_queue_free() as well:
« Enqueue a pointer to be released with g_free() during the next
teardown phase. This is equivalent to calling g_test_queue_destroy()
with a destroy callback of g_free(). »

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20160121/ef94592d/attachment.sig>


More information about the Spice-devel mailing list