[libnice] Optional GUPNP

Labeeb Ibrahim labeeb at hamon.in
Mon Feb 20 12:43:49 UTC 2017


Hello,

I was cleaning up a library that has libnice as a dependency and running
Valgrind on a sample program gave me huge leaks as this.

==========================================================================
==21123== 72,864 (26,496 direct, 46,368 indirect) bytes in 207 blocks are
definitely lost in loss record 2,697 of 2,697
==21123==    at 0x4C27AFF: malloc (home/labeeb/valgrind-3.12.0/
coregrind/m_replacemalloc/vg_replace_malloc.c:298)
==21123==    by 0x4C29ACB: realloc (home/labeeb/valgrind-3.12.0/
coregrind/m_replacemalloc/vg_replace_malloc.c:785)
==21123==    by 0x5CF388D: g_realloc (build/glib2.0-y6934K/glib2.0-
2.42.1/./glib/gmem.c:162)
==21123==    by 0x5CC1399: g_ptr_array_maybe_expand
(build/glib2.0-y6934K/glib2.0-2.42.1/./glib/garray.c:1118)
==21123==    by 0x5CC24BA: g_ptr_array_add (build/glib2.0-y6934K/glib2.0-
2.42.1/./glib/garray.c:1382)
==21123==    by 0x574CF9C: g_socket_receive_message
(build/glib2.0-y6934K/glib2.0-2.42.1/./gio/gsocket.c:4303)
==21123==    by 0x815BD10: socket_source_cb (tmp/buildd/gssdp-0.14.10/
libgssdp/gssdp-client.c:1149)
==21123==    by 0x574A610: socket_source_dispatch
(build/glib2.0-y6934K/glib2.0-2.42.1/./gio/gsocket.c:3264)
==21123==    by 0x5CEDB6C: g_main_dispatch (build/glib2.0-y6934K/glib2.0-
2.42.1/./glib/gmain.c:3111)
==21123==    by 0x5CEDB6C: g_main_context_dispatch
(build/glib2.0-y6934K/glib2.0-2.42.1/./glib/gmain.c:3710)
==21123==    by 0x5CEDF47: g_main_context_iterate.isra.29
(build/glib2.0-y6934K/glib2.0-2.42.1/./glib/gmain.c:3781)
==21123==    by 0x5CEE271: g_main_loop_run (build/glib2.0-y6934K/glib2.0-
2.42.1/./glib/gmain.c:3975)
==21123==    by 0x7055D3D: thread_func (build/gupnp-igd-3fIP_x/gupnp-
igd-0.2.4/./libgupnp-igd/gupnp-simple-igd-thread.c:297)
==21123==    by 0x5D14844: g_thread_proxy (build/glib2.0-y6934K/glib2.0-
2.42.1/./glib/gthread.c:764)
==21123==    by 0x627A063: start_thread (build/glibc-qK83Be/glibc-2.
19/nptl/pthread_create.c:309)
==21123==    by 0x678062C: clone (build/glibc-qK83Be/glibc-2.
19/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:111)

============================================================
==========================================

Being a newbie with libnice, I couldn't figure out the cause of the leak
despite my online researches. Knowing that gupnp is optional for libnice, I
recompiled libnice disabling gupnp and then ran Valgrind on my sample
program. To my surprise, the leak vanishes. I have a few questions.

1 - Can someone tell me why the leak occurs?
2 - Why is gupno optional for libnice?

I will be glad if someone helps me with the answers.

Thanks,
Labeeb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/nice/attachments/20170220/7f74348a/attachment.html>


More information about the nice mailing list