[patch][commit] Dangling Pointer

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[patch][commit] Dangling Pointer

Dave Brolley-2
Hi,

I've committed the attached patch which corrects a problem with a
dangling pointer in sid/component/cfgroot/libltdl. The comment in the
code explains the problem.

Is there an upstream repository for this library that should also be
examined/updated?

Dave

2007-01-17  Dave Brolley  <[hidden email]>

        * libltdl/ltdl.c (lt_dlexit): After each call to lt_dlclose, make sure
        that the handle pointed to by 'cur' still exists.


Index: sid/component/cfgroot/libltdl/ltdl.c
===================================================================
RCS file: /cvs/src/src/sid/component/cfgroot/libltdl/ltdl.c,v
retrieving revision 1.3
diff -c -p -r1.3 ltdl.c
*** sid/component/cfgroot/libltdl/ltdl.c 4 Jun 2005 03:23:01 -0000 1.3
--- sid/component/cfgroot/libltdl/ltdl.c 17 Jan 2007 21:13:53 -0000
***************
*** 1,5 ****
  /* ltdl.c -- system independent dlopen wrapper
!    Copyright (C) 1998, 1999, 2000, 2004  Free Software Foundation, Inc.
     Originally by Thomas Tanner <[hidden email]>
     This file is part of GNU Libtool.
 
--- 1,5 ----
  /* ltdl.c -- system independent dlopen wrapper
!    Copyright (C) 1998, 1999, 2000, 2004, 2007  Free Software Foundation, Inc.
     Originally by Thomas Tanner <[hidden email]>
     This file is part of GNU Libtool.
 
*************** lt_dlexit ()
*** 2330,2335 ****
--- 2330,2344 ----
       ++errors;
     }
  }
+      /* Make sure that the handle pointed to by 'cur' still exists.
+ lt_dlclose recursively closes dependent libraries which removes
+ them from the linked list.  One of these might be the one
+ pointed to by 'cur'.  */
+      for (tmp = handles; tmp; tmp = tmp->next)
+ if (tmp == cur)
+  break;
+      if (! tmp)
+ cur = handles;
     }
   /* done if only resident modules are left */
   if (!saw_nonresident)
Reply | Threaded
Open this post in threaded view
|

Re: [patch][commit] Dangling Pointer

Frank Ch. Eigler
Hi -

> I've committed the attached patch which corrects a problem with a
> dangling pointer in sid/component/cfgroot/libltdl. The comment in the
> code explains the problem.

Thank you.

> Is there an upstream repository for this library that should also be
> examined/updated?

libltdl comes from libtool.

- FChE