Fixed bug in @name'ing players where game would crash.
authorRick L Bird <nveid@yahoo.com>
Fri, 22 Apr 2011 22:22:42 +0000 (18:22 -0400)
committerRick L Bird <nveid@yahoo.com>
Fri, 22 Apr 2011 22:22:42 +0000 (18:22 -0400)
src/plyrlist.c

index 082a2ac08e0462ec69bd314f6d2fc9a6fe3d918c..ea289ceace8ff58bdb4c477192c2a8dc04686a42 100644 (file)
@@ -85,7 +85,6 @@ add_player(dbref player)
 void
 add_player_alias(dbref player, const char *alias)
 {
-  long tmp;
   char tbuf1[BUFFER_LEN], *s, *sp;
   if (!hft_initialized)
     init_hft();
@@ -100,8 +99,12 @@ add_player_alias(dbref player, const char *alias)
     while (sp && *sp && *sp == ' ')
       sp++;
     if (sp && *sp) {
-      tmp = player;
-      hashadd(strupper(sp), (void *) tmp, &htab_player_list);
+      dbref *p;
+      p = slab_malloc(player_dbref_slab, NULL);
+      if (!p)
+        mush_panic(T("Unable to allocate memory in plyrlist!"));
+      *p = player;
+      hashadd(strupper(sp), p, &htab_player_list);
     }
   }
 }