فهرست منبع

ctl: fifo - clean intermediary buffer

(cherry picked from commit 4c4d7f7967a99d4dd4acdc5e198bce493bf15d67)
(cherry picked from commit c68522f5c3c59cb915feb873bd3351e57a8db579)
(cherry picked from commit 90122e3a46169e9f10dc7d8e01638d5f89cfaae5)
Daniel-Constantin Mierla 7 ماه پیش
والد
کامیت
6b4fb8ddea
1فایلهای تغییر یافته به همراه3 افزوده شده و 1 حذف شده
  1. 3 1
      src/modules/ctl/fifo_server.c

+ 3 - 1
src/modules/ctl/fifo_server.c

@@ -1259,7 +1259,7 @@ err:
 static int rpc_struct_printf(struct text_chunk *c, char *name, char *fmt, ...)
 {
 	int n, buf_size;
-	char *buf;
+	char *buf = NULL;
 	char *buf0;
 	va_list ap;
 	str s, nm;
@@ -1312,6 +1312,7 @@ static int rpc_struct_printf(struct text_chunk *c, char *name, char *fmt, ...)
 			c->next = m;
 			if(c == ctx->last)
 				ctx->last = m;
+			ctl_free(buf);
 			return 0;
 		}
 		/* Else try again with more space. */
@@ -1327,6 +1328,7 @@ static int rpc_struct_printf(struct text_chunk *c, char *name, char *fmt, ...)
 		}
 		buf = buf0;
 	}
+	ctl_free(buf);
 	return 0;
 err:
 	if(buf)