Changeset 599a1c7 in mainline for version

Timestamp:
2018-12-29T20:19:00Z (6 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Parents:
accdbd83
git-author:
Matthieu Riolo <matthieu.riolo@…> (2018-12-28 20:53:29)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2018-12-29 20:19:00)
Message:

Prevents 'ls -r' from crashing when executed in an empty directory

This fixes #779 by adding an extra test around realloc().
The current implementation of realloc() releases the given pointer
and returns NULL if the new requested size is 0. This behavior is
implementation-defined and has been changed with d802331. The
function ls_scan_dir() expected NULL to be returned only in
case of an allocation failure. Therefore, the function
ls_scan_dir() used to display an CL_ENOMEM error and returned
back to ls_recursive(). ls_recursive() would attempt to release
the already freed pointer a second time which would lead
bdsh to break. This commit will prevent this from happening by
avoiding the realloc() call in the first place.

(No files)

Note: See TracChangeset for help on using the changeset viewer.