summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/dll_init.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2010-05-03 16:40:33 +0000
committerChristopher Faylor <me@cgf.cx>2010-05-03 16:40:33 +0000
commit73bcd49b1f0f02cad25ebf8b14d549983697a571 (patch)
tree15c6afec55f14318868e7fa1ec7232ebf3e99750 /winsup/cygwin/dll_init.cc
parent6a0cef6012fb834460ccae9cd1c7c754e11ac2b6 (diff)
downloadcygnal-73bcd49b1f0f02cad25ebf8b14d549983697a571.tar.gz
cygnal-73bcd49b1f0f02cad25ebf8b14d549983697a571.tar.bz2
cygnal-73bcd49b1f0f02cad25ebf8b14d549983697a571.zip
* dll_init.cc (dll_list::alloc): Add debugging assertion.
Diffstat (limited to 'winsup/cygwin/dll_init.cc')
-rw-r--r--winsup/cygwin/dll_init.cc47
1 files changed, 25 insertions, 22 deletions
diff --git a/winsup/cygwin/dll_init.cc b/winsup/cygwin/dll_init.cc
index 24d6d5c5f..c2b141362 100644
--- a/winsup/cygwin/dll_init.cc
+++ b/winsup/cygwin/dll_init.cc
@@ -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;
}