p-990203-0
ldmud-3.2.9/src/done/p-990203-0 · 1.8 KB
From the archive ldmud-329.tar.gz
Download the archive « Back to the archive contents
Short: Memory leak in terminal_colour()
From: Michael Sporn (sporn@mathematik.hu-berlin.de, sunblood@tubmud)
Date: 990121
Type: Patch
State: Applied.
See also b-990203-1.
Das memory leak entsteht in terminal_colour. Bei jedem Aufruf werden das
1. Argument und gewisse Hilfsstrings nicht freigegeben. Gerade wenn alle
messages an user durch diese Funktion laufen, wirkt sich das recht
verheerend aus.
*** ldmud-3.2.5.orig/interpret.c Thu Dec 10 03:37:36 1998
--- ldmud-3.2.5/interpret.c Tue Jan 19 00:58:19 1999
***************
*** 4167,4178 ****
/* dirty hack to make an svalue from parts[i] */
mkey.type = T_STRING;
! mkey.x.string_type = STRING_MALLOC;
! mkey.u.string = string_copy( parts[i] );
/* now look for mapping data */
mdata = get_map_lvalue( sp->u.map, & mkey, 0 );
/* if it is a string, use it as part, if not, go on with the old */
if ( mdata && mdata->type == T_STRING ) {
parts[i] = mdata->u.string;
--- 4168,4183 ----
/* dirty hack to make an svalue from parts[i] */
mkey.type = T_STRING;
!
! /* sunblood: get_map_lvalue makes the string shared anyway */
! mkey.x.string_type = STRING_SHARED;
! mkey.u.string = make_shared_string( parts[i] );
/* now look for mapping data */
mdata = get_map_lvalue( sp->u.map, & mkey, 0 );
+ free_string( mkey.u.string );
+
/* if it is a string, use it as part, if not, go on with the old */
if ( mdata && mdata->type == T_STRING ) {
parts[i] = mdata->u.string;
***************
*** 4363,4368 ****
--- 4368,4374 ----
, j, cp - deststr, sp->u.string, indent, wrap);
}
#endif
+ free_svalue(sp);
put_malloced_string(deststr, sp);
break;
}