From c3f6e181e266f8469925930600bdaf3601eca321 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Mon, 13 Mar 2006 21:56:26 +0000 Subject: [PATCH] * plugins.c (krb5int_get_plugin_dir_data): If dirhandle is null or the file pointer is null, return a one-element list containing just NULL. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17738 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/support/ChangeLog | 6 ++++++ src/util/support/plugins.c | 8 +++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/util/support/ChangeLog b/src/util/support/ChangeLog index eb112f60d..295f42f12 100644 --- a/src/util/support/ChangeLog +++ b/src/util/support/ChangeLog @@ -1,3 +1,9 @@ +2006-03-13 Ken Raeburn + + * plugins.c (krb5int_get_plugin_dir_data): If dirhandle is null or + the file pointer is null, return a one-element list containing + just NULL. + 2006-03-11 Ken Raeburn * Makefile.in (autoconf.h): Note location change. diff --git a/src/util/support/plugins.c b/src/util/support/plugins.c index 8070db6a5..c245a70db 100644 --- a/src/util/support/plugins.c +++ b/src/util/support/plugins.c @@ -283,17 +283,14 @@ krb5int_get_plugin_dir_data (struct plugin_dir_handle *dirhandle, void **p, **newp, *sym; int count, i, err; - if (dirhandle == NULL) { - *ptrs = 0; - return 0; - } - /* XXX Do we need to add a leading "_" to the symbol name on any modern platforms? */ Tprintf("get_plugin_data_sym(%s)\n", symname); p = 0; count = 0; + if (dirhandle == NULL || dirhandle->files == NULL) + goto skip_loop; for (i = 0; !NULL_HANDLE (&dirhandle->files[i]); i++) { int32_t kerr; sym = NULL; @@ -311,6 +308,7 @@ krb5int_get_plugin_dir_data (struct plugin_dir_handle *dirhandle, p[count] = sym; count++; } +skip_loop: newp = realloc(p, (count+1) * sizeof(*p)); if (newp == NULL) goto realloc_failure; -- 2.26.2