diff --git a/main/pbx.c b/main/pbx.c
index 3e0070aa4c0a39852b77cfe5aaf7877aa5532750..4f36b81f38fb426bd8b29c442fa8e20a1a2c4ff9 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -3078,8 +3078,8 @@ static int handle_core_dumpappdocs(int fd, int argc, char *argv[])
fprintf(f, "%% This file is automatically generated. Any manual edits will be lost.\n");
- AST_LIST_LOCK(&apps);
- AST_LIST_TRAVERSE(&apps, app, list) {
+ AST_RWLIST_RDLOCK(&apps);
+ AST_RWLIST_TRAVERSE(&apps, app, list) {
if (appname && strcasecmp(app->name, appname))
continue;
@@ -3096,7 +3096,7 @@ static int handle_core_dumpappdocs(int fd, int argc, char *argv[])
if (appname)
break;
}
- AST_LIST_UNLOCK(&apps);
+ AST_RWLIST_UNLOCK(&apps);
fclose(f);