Re: an unnerving problem

From: Pink Floyd (floyd@south.mit.edu)
Date: 10/15/95


   I decided to add log entries for snoop and load...

   well, I added a log entry in stop_snooping(), and it caused a bad 
   problem... it started allocating 100megs of memory to the mud...
   and all I did was add "char *buf;" and before 
   ch->desc->snooping = NULL;
   I added

   sprintf(buf, "(GC) %s has stopped snooping.", GET_NAME(ch));
   mudlog(buf, NRM, LVL_GRGOD, TRUE);


   This problem happened only when I typed "snoop" to stop snooping.

   ANY ideas as to why?

Sure, you never initialize the pointer *buf.  That sprintf statement will 
screw everything up.  Try changing the declaration from
  char *buf;
to
  char[512];  /* or however big you think you'll need, for this example
                 512 should be plenty */



This archive was generated by hypermail 2b30 : 12/07/00 PST