tree schema BUGFIX check for NULL extension definition before free
diff --git a/src/tree_schema_free.c b/src/tree_schema_free.c
index 79d46ba..171e5e4 100644
--- a/src/tree_schema_free.c
+++ b/src/tree_schema_free.c
@@ -486,7 +486,9 @@
     if (ext->def && ext->def->plugin && ext->def->plugin->free) {
         ext->def->plugin->free(ctx, ext);
     }
-    lysc_extension_free(ctx, &ext->def);
+    if (ext->def) {
+        lysc_extension_free(ctx, &ext->def);
+    }
     FREE_STRING(ctx, ext->argument);
     FREE_ARRAY(ctx, ext->exts, lysc_ext_instance_free);
 }