From fd482863f28f3fcf432197077cbc2757d59869b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Sat, 1 Mar 1997 14:10:31 +0100 Subject: [PATCH] Fixed out of memory bug. Rev: src/modules/files/efuns.c:1.20 --- src/modules/files/efuns.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/modules/files/efuns.c b/src/modules/files/efuns.c index 3fe7a3ba8a..395e1a4749 100644 --- a/src/modules/files/efuns.c +++ b/src/modules/files/efuns.c @@ -190,18 +190,15 @@ void f_get_dir(INT32 args) int lens[FPR]; struct dirent *tmp; - tmp = alloca(sizeof(struct dirent) + + if (!(tmp = alloca(sizeof(struct dirent) + #ifdef HAVE_SOLARIS_READDIR_R - pathconf(path, _PC_NAME_MAX) + pathconf(path, _PC_NAME_MAX) #else - NAME_MAX + NAME_MAX #endif /* HAVE_SOLARIS_READDIR_R */ - + 1); - - if(!tmp) - { + + 1))) { closedir(dir); - error("Out of memory.\n"); + error("get_dir(): Out of memory\n"); } while(1) -- GitLab