X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=command.c;h=41a58eac0517e15e44c964250578173708289e60;hb=a8573c4bfa41a407247fb1cae56cf9dfb890d6ca;hp=79ca3652040188010dbbf2209fbf8ffe5757db50;hpb=e2eebf654cae2fc004cee516a0e165127c0214ca;p=paraslash.git diff --git a/command.c b/command.c index 79ca3652..41a58eac 100644 --- 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; }