Browse Source

Stack: Avoid NULL-dereference

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=14425

Credit to oss-fuzz
Stefan Profanter 5 years ago
parent
commit
004d7d23af
1 changed files with 3 additions and 0 deletions
  1. 3 0
      plugins/ua_nodestore_default.c

+ 3 - 0
plugins/ua_nodestore_default.c

@@ -396,6 +396,9 @@ UA_Nodestore_new(void **nsCtx) {
 
 
 void
 void
 UA_Nodestore_delete(void *nsCtx) {
 UA_Nodestore_delete(void *nsCtx) {
+	if (!nsCtx)
+		return;
+
     NodeMap *ns = (NodeMap*)nsCtx;
     NodeMap *ns = (NodeMap*)nsCtx;
 #ifdef UA_ENABLE_MULTITHREADING
 #ifdef UA_ENABLE_MULTITHREADING
     pthread_mutex_destroy(&ns->mutex);
     pthread_mutex_destroy(&ns->mutex);