BUGFIX check return codes of asprintf() and chdir()

For some compilers these functions are defined with warn_unused_result
attribute and ignoring the return value generates compiler's warning
diff --git a/src/tree_schema.c b/src/tree_schema.c
index deb6ad2..af6910e 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -1092,11 +1092,12 @@
     if (module && !module->filepath) {
         /* get URI if there is /proc */
         addr = NULL;
-        asprintf(&addr, "/proc/self/fd/%d", fd);
-        if ((len = readlink(addr, buf, PATH_MAX - 1)) > 0) {
-            ((struct lys_module *)module)->filepath = lydict_insert(ctx, buf, len);
+        if (asprintf(&addr, "/proc/self/fd/%d", fd) != -1) {
+            if ((len = readlink(addr, buf, PATH_MAX - 1)) > 0) {
+                ((struct lys_module *)module)->filepath = lydict_insert(ctx, buf, len);
+            }
+            free(addr);
         }
-        free(addr);
     }
 
     return module;