Type misalignments and mem leaks in renumber_all, do_justify and do_spell (Rocco & Steven Kneizys)

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1108 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Chris Allegretta 2002-03-06 03:30:40 +00:00
parent 26d59eae5f
commit bef1297c6d
2 changed files with 12 additions and 5 deletions

View File

@ -1,5 +1,8 @@
CVS code - CVS code -
- General
- Type misalignments and mem leaks in renumber_all, do_justify
and do_spell (Rocco & Steven Kneizys).
GNU nano 1.1.7 - 03/05/2002 GNU nano 1.1.7 - 03/05/2002
- General - General
- malloc->calloc, etc cleanups (DLR). - malloc->calloc, etc cleanups (DLR).

12
nano.c
View File

@ -367,7 +367,7 @@ int free_filestruct(filestruct * src)
int renumber_all(void) int renumber_all(void)
{ {
filestruct *temp; filestruct *temp;
long i = 1; int i = 1;
for (temp = fileage; temp != NULL; temp = temp->next) { for (temp = fileage; temp != NULL; temp = temp->next) {
temp->lineno = i++; temp->lineno = i++;
@ -1524,8 +1524,9 @@ int do_int_spell_fix(char *word)
} }
/* restore the search/replace strings */ /* restore the search/replace strings */
last_search = mallocstrcpy(last_search, save_search); free(last_search); last_search=save_search;
last_replace = mallocstrcpy(last_replace, save_replace); free(last_replace); last_replace=save_replace;
free(prevanswer);
/* restore where we were */ /* restore where we were */
current = begin; current = begin;
@ -1755,6 +1756,7 @@ int do_spell(void)
if (write_file(temp, 1, 0, 0) == -1) { if (write_file(temp, 1, 0, 0) == -1) {
statusbar(_("Spell checking failed: unable to write temp file!")); statusbar(_("Spell checking failed: unable to write temp file!"));
free(temp);
return 0; return 0;
} }
@ -1777,6 +1779,7 @@ int do_spell(void)
else else
statusbar(_("Spell checking failed")); statusbar(_("Spell checking failed"));
free(temp);
return spell_res; return spell_res;
#endif #endif
@ -2237,7 +2240,8 @@ int do_justify(void)
return 1; return 1;
#else #else
int slen = 0; /* length of combined lines on one line. */ int slen = 0; /* length of combined lines on one line. */
int initial_y, kbinput = 0, totbak; int initial_y, kbinput = 0;
long totbak;
filestruct *initial = NULL, *tmpjust = NULL, *cutbak, *tmptop, *tmpbot; filestruct *initial = NULL, *tmpjust = NULL, *cutbak, *tmptop, *tmpbot;
filestruct *samecheck = current; filestruct *samecheck = current;
int qdepth = 0; int qdepth = 0;