зеркало из https://github.com/github/putty.git
Unix: fix segfault if ~/.putty/sessions doesn't exist.
Looks as if I introduced this in commit 733fcca2c
, where the pointer
returned from enum_settings_start() stopped being the same thing as
the underlying 'DIR *' - I needed to retain a check for the outer
containing structure not being NULL but the DIR * being NULL inside
it.
This commit is contained in:
Родитель
34df99907a
Коммит
9072bab11b
|
@ -562,6 +562,9 @@ char *enum_settings_next(settings_e *handle, char *buffer, int buflen)
|
||||||
int maxlen, thislen, len;
|
int maxlen, thislen, len;
|
||||||
char *unmunged;
|
char *unmunged;
|
||||||
|
|
||||||
|
if (!handle->dp)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
fullpath = make_filename(INDEX_SESSIONDIR, NULL);
|
fullpath = make_filename(INDEX_SESSIONDIR, NULL);
|
||||||
maxlen = len = strlen(fullpath);
|
maxlen = len = strlen(fullpath);
|
||||||
|
|
||||||
|
@ -592,6 +595,7 @@ char *enum_settings_next(settings_e *handle, char *buffer, int buflen)
|
||||||
|
|
||||||
void enum_settings_finish(settings_e *handle)
|
void enum_settings_finish(settings_e *handle)
|
||||||
{
|
{
|
||||||
|
if (handle->dp)
|
||||||
closedir(handle->dp);
|
closedir(handle->dp);
|
||||||
sfree(handle);
|
sfree(handle);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче