[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nano-devel] splint finds memory-leaks in nano.c
From: |
Rocco Corsi |
Subject: |
[Nano-devel] splint finds memory-leaks in nano.c |
Date: |
Sat, 02 Mar 2002 02:51:57 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2.1) Gecko/20010901 |
I fixed a few obvious memory leaks in nano.c using report from splint.
Rocco
Index: nano.c
===================================================================
RCS file: /cvsroot/nano/nano/nano.c,v
retrieving revision 1.234
diff -u -r1.234 nano.c
--- nano.c 27 Feb 2002 04:14:16 -0000 1.234
+++ nano.c 2 Mar 2002 07:40:09 -0000
@@ -1516,8 +1516,9 @@
}
/* restore the search/replace strings */
- last_search = mallocstrcpy(last_search, save_search);
- last_replace = mallocstrcpy(last_replace, save_replace);
+ free(last_search); last_search=save_search;
+ free(last_replace); last_replace=save_replace;
+ free(prevanswer);
/* restore where we were */
current = begin;
@@ -1747,6 +1748,7 @@
if (write_file(temp, 1, 0, 0) == -1) {
statusbar(_("Spell checking failed: unable to write temp file!"));
+ free(temp);
return 0;
}
@@ -1769,6 +1771,7 @@
else
statusbar(_("Spell checking failed"));
+ free(temp);
return spell_res;
#endif
- [Nano-devel] splint finds memory-leaks in nano.c,
Rocco Corsi <=