* editcmd.c (freestrs): Set freed strings to NULL.

(catstrs): Use g_malloc() and g_free().
This commit is contained in:
Pavel Roskin 2002-08-20 23:57:34 +00:00
parent 2e88c3b557
commit 4756fbf271
2 changed files with 7 additions and 5 deletions

View File

@ -1,5 +1,8 @@
2002-08-20 Pavel Roskin <proski@gnu.org>
* editcmd.c (freestrs): Set freed strings to NULL.
(catstrs): Use g_malloc() and g_free().
* editcmd.c (freestrs): New function to clean temporary strings.
* edit.c (edit_clean): Call freestrs().

View File

@ -130,10 +130,9 @@ char *catstrs (const char *first,...)
len++;
i = (i + 1) % 16;
if (stacked[i])
free (stacked[i]);
g_free (stacked[i]);
stacked[i] = malloc (len);
stacked[i] = g_malloc (len);
va_end (ap);
va_start (ap, first);
strcpy (stacked[i], first);
@ -150,8 +149,8 @@ void freestrs(void)
int i;
for (i = 0; i < sizeof(stacked) / sizeof(stacked[0]); i++) {
if (stacked[i])
free (stacked[i]);
g_free (stacked[i]);
stacked[i] = NULL;
}
}