aboutsummaryrefslogtreecommitdiff
path: root/bfd/opncls.c
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1991-05-04 22:52:03 +0000
committerJohn Gilmore <gnu@cygnus>1991-05-04 22:52:03 +0000
commitb1847ba9e7da744bb3695f9611dad4119cc7991e (patch)
tree7ca7f7e925b75f84599248690f7e6f30cacd702a /bfd/opncls.c
parentf929c7d43b5edde3aabc92506edce40bf38b95a0 (diff)
downloadgdb-b1847ba9e7da744bb3695f9611dad4119cc7991e.zip
gdb-b1847ba9e7da744bb3695f9611dad4119cc7991e.tar.gz
gdb-b1847ba9e7da744bb3695f9611dad4119cc7991e.tar.bz2
Saber C cleanup. Fix horrid bug in opncls.c in which an obstack is
initialized on the stack and then copied into its own allocated space. (Wow, Steve, you're twisted...)
Diffstat (limited to 'bfd/opncls.c')
-rw-r--r--bfd/opncls.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/bfd/opncls.c b/bfd/opncls.c
index 9b91c2f..b280a13 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -58,15 +58,14 @@ FILE *bfd_open_file();
bfd *new_bfd()
{
- struct obstack tmp;
bfd *nbfd;
- obstack_begin(&tmp,128);
-
- nbfd = (bfd *)obstack_alloc(&tmp,sizeof(bfd));
- memset((PTR)nbfd, 0, sizeof (bfd)); /* Clear it */
- nbfd->memory = tmp;
+ nbfd = (bfd *)zalloc (sizeof (bfd));
+ if (!nbfd)
+ return 0;
+ obstack_begin(&nbfd->memory, 128);
+
nbfd->direction = no_direction;
nbfd->iostream = NULL;
nbfd->where = 0;