Allowing an array parameter to be NULL.

This fixes Savannah bug #46420.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5457 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2015-11-30 16:44:44 +00:00
parent 66e21416af
commit 42ac5368e1
3 changed files with 5 additions and 3 deletions

View File

@ -6,6 +6,8 @@
* src/text.c (add_undo, update_undo, do_undo, do_redo), src/nano.h: * src/text.c (add_undo, update_undo, do_undo, do_redo), src/nano.h:
Store and retrieve the correct file size before and after an action. Store and retrieve the correct file size before and after an action.
This fixes Savannah bug #45523. This fixes Savannah bug #45523.
* src/files.c (free_chararray): Allow the parameter to be NULL.
This fixes Savannah bug #46420.
2015-11-29 Benno Schulenberg <bensberg@justemail.net> 2015-11-29 Benno Schulenberg <bensberg@justemail.net>
* src/color.c (reset_multis): Evaluate correctly whether to reset * src/color.c (reset_multis): Evaluate correctly whether to reset

View File

@ -460,7 +460,6 @@ void browser_init(const char *path, DIR *dir)
rewinddir(dir); rewinddir(dir);
if (filelist != NULL)
free_chararray(filelist, filelist_len); free_chararray(filelist, filelist_len);
filelist_len = i; filelist_len = i;

View File

@ -2553,7 +2553,8 @@ int diralphasort(const void *va, const void *vb)
* elements. */ * elements. */
void free_chararray(char **array, size_t len) void free_chararray(char **array, size_t len)
{ {
assert(array != NULL); if (array == NULL)
return;
for (; len > 0; len--) for (; len > 0; len--)
free(array[len - 1]); free(array[len - 1]);