diff --git a/src/backend/sse.c b/src/backend/sse.c index fbfbe59..c2ce7a0 100644 --- a/src/backend/sse.c +++ b/src/backend/sse.c @@ -448,8 +448,13 @@ sp_sse_finish(struct sp_sse *s, struct sp_reply *out, struct sp_buf *err) return 0; out->calls = calloc(s->ncalls, sizeof(*out->calls)); - if (out->calls == NULL) + if (out->calls == NULL) { + /* the content is already in out; a failed reply is not freed by + * the caller, so it must be released here */ + free(out->content); + out->content = NULL; return -1; + } out->ncalls = s->ncalls; for (i = 0; i < s->ncalls; i++) { char idbuf[32];