]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - command.c
build: Fix --with-opus-libs.
[paraslash.git] / command.c
index 79ca3652040188010dbbf2209fbf8ffe5757db50..41a58eac0517e15e44c964250578173708289e60 100644 (file)
--- a/command.c
+++ b/command.c
@@ -474,11 +474,8 @@ static int com_version(struct command_context *cc)
  */
 static unsigned empty_status_items(int parser_friendly, char **result)
 {
-       static char *esi;
-       static unsigned len;
-
-       if (esi)
-               goto out;
+       char *esi;
+       unsigned len;
 
        if (parser_friendly)
                len = xasprintf(&esi,
@@ -498,7 +495,6 @@ static unsigned empty_status_items(int parser_friendly, char **result)
                        EMPTY_STATUS_ITEMS
                        #undef ITEM
                );
-out:
        *result = esi;
        return len;
 }
@@ -509,7 +505,7 @@ static int com_stat(struct command_context *cc)
 {
        int i, ret;
        struct misc_meta_data tmp, *nmmd = &tmp;
-       char *s, *esi = NULL;
+       char *s;
        int32_t num = 0;
        int parser_friendly = 0;
 
@@ -549,12 +545,15 @@ static int com_stat(struct command_context *cc)
                if (ret < 0)
                        goto out;
                if (nmmd->vss_status_flags & VSS_NEXT) {
+                       char *esi;
                        ret = empty_status_items(parser_friendly, &esi);
                        if (cc->use_sideband)
                                ret = send_sb(&cc->scc, esi, ret, SBD_OUTPUT,
-                                       true);
-                       else
+                                       false);
+                       else {
                                ret = sc_send_bin_buffer(&cc->scc, esi, ret);
+                               free(esi);
+                       }
                        if (ret < 0)
                                goto out;
                } else
@@ -568,7 +567,6 @@ static int com_stat(struct command_context *cc)
                        goto out;
        }
 out:
-       free(esi);
        return ret;
 }