@@ -580,9 +580,7 @@ bool Inventory::AddCounterMeasure(int id, int aux_type, int aux_id, int flags, c
580
580
newnode->iflags |= INVF_SELECTABLE | INVF_USEABLE | INVF_MISSIONITEM | INVF_TIMEOUTONSPEW;
581
581
582
582
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 );
586
584
} else {
587
585
newnode->icon_name = nullptr ;
588
586
}
@@ -647,8 +645,7 @@ bool Inventory::AddObjectItem(int otype, int oid, int oauxt, int oauxi, int flag
647
645
newnode->oid = oauxi;
648
646
649
647
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 );
652
649
} else {
653
650
newnode->description = mem_rmalloc<char >();
654
651
newnode->description [0 ] = 0 ;
@@ -672,8 +669,7 @@ bool Inventory::AddObjectItem(int otype, int oid, int oauxt, int oauxi, int flag
672
669
if (flags & INVAF_LEVELLAST)
673
670
newnode->iflags |= INVAF_LEVELLAST;
674
671
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 );
677
673
678
674
if (description) {
679
675
newnode->name = mem_strdup (description);
0 commit comments