From 2e6218bd293dda83c155150e45b91b14993ec5c0 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Mon, 3 May 2010 10:02:58 +0200 Subject: [PATCH] Fix segfault when loading Plugins --- bacula/src/lib/plugins.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bacula/src/lib/plugins.c b/bacula/src/lib/plugins.c index a0af158525..7b7d324fe0 100644 --- a/bacula/src/lib/plugins.c +++ b/bacula/src/lib/plugins.c @@ -121,6 +121,8 @@ bool load_plugins(void *binfo, void *bfuncs, const char *plugin_dir, } entry = (struct dirent *)malloc(sizeof(struct dirent) + name_max + 1000); for ( ;; ) { + plugin = NULL; /* Start from a fresh plugin */ + if ((readdir_r(dp, entry, &result) != 0) || (result == NULL)) { if (!found) { Jmsg(NULL, M_WARNING, 0, _("Failed to find any plugins in %s\n"), -- 2.39.5