diff --git a/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c b/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c index fb435156a..bd67a64af 100644 --- a/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c +++ b/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c @@ -248,7 +248,9 @@ foreach_func (const char *filename, lt_ptr data) } result = lib_list (list); +#if !defined(VALGRIND) lt_dlclose (lh); +#endif if (result < 0) { gp_log (GP_LOG_DEBUG, "gphoto2-port-info-list", _("Could not load port driver list: '%s'."), diff --git a/libgphoto2_port/libgphoto2_port/gphoto2-port.c b/libgphoto2_port/libgphoto2_port/gphoto2-port.c index 56d1f4fe8..571f364e7 100644 --- a/libgphoto2_port/libgphoto2_port/gphoto2-port.c +++ b/libgphoto2_port/libgphoto2_port/gphoto2-port.c @@ -167,8 +167,10 @@ gp_port_set_info (GPPort *port, GPPortInfo info) port->pc->ops = NULL; } if (port->pc->lh) { +#if !defined(VALGRIND) lt_dlclose (port->pc->lh); lt_dlexit (); +#endif } lt_dlinit (); @@ -348,8 +350,10 @@ gp_port_free (GPPort *port) } if (port->pc->lh) { +#if !defined(VALGRIND) lt_dlclose (port->pc->lh); lt_dlexit (); +#endif port->pc->lh = NULL; }