OSDN Git Service

* dll_init.cc (dll_list::alloc): Add debugging assertion.
authorcgf <cgf>
Mon, 3 May 2010 16:40:31 +0000 (16:40 +0000)
committercgf <cgf>
Mon, 3 May 2010 16:40:31 +0000 (16:40 +0000)
winsup/cygwin/ChangeLog
winsup/cygwin/dll_init.cc

index 5a0efa9..e5fbc9e 100644 (file)
@@ -1,3 +1,7 @@
+2010-05-03  Christopher Faylor  <me+cygwin@cgf.cx>
+
+       * dll_init.cc (dll_list::alloc): Add debugging assertion.
+
 2010-04-29  Corinna Vinschen  <corinna@vinschen.de>
 
        * dlfcn.cc (get_full_path_of_dll): Handle non-existent file.
index 24d6d5c..c2b1413 100644 (file)
@@ -22,6 +22,7 @@ details. */
 #include "exception.h"
 #include <wchar.h>
 #include <sys/reent.h>
+#include <assert.h>
 
 extern void __stdcall check_sanity_and_sync (per_process *);
 
@@ -118,29 +119,31 @@ dll_list::alloc (HINSTANCE h, per_process *p, dll_type type)
     {
       if (!in_forkee)
        d->count++;     /* Yes.  Bump the usage count. */
-      return d;                /* Return previously allocated pointer. */
     }
-
-  /* FIXME: Change this to new at some point. */
-  d = (dll *) cmalloc (HEAP_2_DLL, sizeof (*d) + (namelen * sizeof (*name)));
-
-  /* Now we've allocated a block of information.  Fill it in with the supplied
-     info about this DLL. */
-  d->count = 1;
-  wcscpy (d->name, name);
-  d->handle = h;
-  d->has_dtors = true;
-  d->p = p;
-  d->type = type;
-  if (end == NULL)
-    end = &start;      /* Point to "end" of dll chain. */
-  end->next = d;       /* Standard linked list stuff. */
-  d->next = NULL;
-  d->prev = end;
-  end = d;
-  tot++;
-  if (type == DLL_LOAD)
-    loaded_dlls++;
+  else
+    {
+      /* FIXME: Change this to new at some point. */
+      d = (dll *) cmalloc (HEAP_2_DLL, sizeof (*d) + (namelen * sizeof (*name)));
+
+      /* Now we've allocated a block of information.  Fill it in with the supplied
+        info about this DLL. */
+      d->count = 1;
+      wcscpy (d->name, name);
+      d->handle = h;
+      d->has_dtors = true;
+      d->p = p;
+      d->type = type;
+      if (end == NULL)
+       end = &start;   /* Point to "end" of dll chain. */
+      end->next = d;   /* Standard linked list stuff. */
+      d->next = NULL;
+      d->prev = end;
+      end = d;
+      tot++;
+      if (type == DLL_LOAD)
+       loaded_dlls++;
+    }
+  assert (p->envptr != NULL);
   return d;
 }