mirror of https://github.com/MidnightCommander/mc
* editcmd.c (freestrs): Set freed strings to NULL.
(catstrs): Use g_malloc() and g_free().
This commit is contained in:
parent
2e88c3b557
commit
4756fbf271
|
@ -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().
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue