Add close_file arg to saxdb_close_context(); allocate all saxdb contexts from heap.
[srvx.git] / src / modcmd.c
index f30a4e9f073daf7688478cbb309229c15de416e8..7ae19af97739b126432fa2bf6415c2e7531526a6 100644 (file)
@@ -1834,17 +1834,14 @@ static MODCMD_FUNC(cmd_dump_messages) {
         reply("MSG_INTERNAL_FAILURE");
         return 0;
     }
-    if ((res = setjmp(ctx->jbuf)) != 0) {
-        ctx->complex.used = 0; /* to avoid false assert()s in close */
-        saxdb_close_context(ctx);
-        fclose(pf);
+    if ((res = setjmp(*saxdb_jmp_buf(ctx))) != 0) {
+        saxdb_close_context(ctx, 1);
         reply("MCMSG_MESSAGE_DUMP_FAILED", strerror(res));
         return 0;
     } else {
         for (it = dict_first(lang_C->messages); it; it = iter_next(it))
             saxdb_write_string(ctx, iter_key(it), iter_data(it));
-        saxdb_close_context(ctx);
-        fclose(pf);
+        saxdb_close_context(ctx, 1);
         reply("MCMSG_MESSAGES_DUMPED", fname);
         return 1;
     }