schema parsers BUGFIX replacing type by deviation

Make sure that the type struct is empty before resolving the new type
set by deviation.

Fixes #380
diff --git a/src/parser_yin.c b/src/parser_yin.c
index 4434980..efa7d54 100644
--- a/src/parser_yin.c
+++ b/src/parser_yin.c
@@ -2502,8 +2502,10 @@
 
                 /* replace */
                 lys_type_free(ctx, t, NULL);
+                memset(t, 0, sizeof (struct lys_type));
                 /* HACK for unres */
                 t->der = (struct lys_tpdf *)child;
+                t->parent = (struct lys_tpdf *)dev_target;
                 if (unres_schema_add_node(module, unres, t, UNRES_TYPE_DER, dev_target) == -1) {
                     goto error;
                 }