@@ -580,9 +580,7 @@ bool Inventory::AddCounterMeasure(int id, int aux_type, int aux_id, int flags, c
580580 newnode->iflags |= INVF_SELECTABLE | INVF_USEABLE | INVF_MISSIONITEM | INVF_TIMEOUTONSPEW;
581581
582582 if (Weapons[id].icon_handle >= 0 ) {
583- newnode->icon_name =
584- mem_rmalloc<char >(strlen (GameBitmaps[GameTextures[Weapons[id].icon_handle ].bm_handle ].name ) + 1 );
585- strcpy (newnode->icon_name , GameBitmaps[GameTextures[Weapons[id].icon_handle ].bm_handle ].name );
583+ newnode->icon_name = mem_strdup (GameBitmaps[GameTextures[Weapons[id].icon_handle ].bm_handle ].name );
586584 } else {
587585 newnode->icon_name = nullptr ;
588586 }
@@ -647,8 +645,7 @@ bool Inventory::AddObjectItem(int otype, int oid, int oauxt, int oauxi, int flag
647645 newnode->oid = oauxi;
648646
649647 if (Object_info[oid].description ) {
650- newnode->description = mem_rmalloc<char >(strlen (Object_info[oid].description ) + 1 );
651- strcpy (newnode->description , Object_info[oid].description );
648+ newnode->description = mem_strdup (Object_info[oid].description );
652649 } else {
653650 newnode->description = mem_rmalloc<char >();
654651 newnode->description [0 ] = 0 ;
@@ -672,8 +669,7 @@ bool Inventory::AddObjectItem(int otype, int oid, int oauxt, int oauxi, int flag
672669 if (flags & INVAF_LEVELLAST)
673670 newnode->iflags |= INVAF_LEVELLAST;
674671
675- newnode->icon_name = mem_rmalloc<char >(strlen (Object_info[oid].icon_name ) + 1 );
676- strcpy (newnode->icon_name , Object_info[oid].icon_name );
672+ newnode->icon_name = mem_strdup (Object_info[oid].icon_name );
677673
678674 if (description) {
679675 newnode->name = mem_strdup (description);
0 commit comments