From: Florian Forster Date: Tue, 8 Dec 2015 10:30:38 +0000 (+0100) Subject: src/utils_format_json.c: Check return value of json_escape_string(). X-Git-Tag: collectd-5.5.1~21 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=ec38a982f406ad7db8e95bcb0fc61ecaaa71ea0f;p=collectd.git src/utils_format_json.c: Check return value of json_escape_string(). CID: 37946 --- diff --git a/src/utils_format_json.c b/src/utils_format_json.c index 23a0fdf0..020d80be 100644 --- a/src/utils_format_json.c +++ b/src/utils_format_json.c @@ -262,8 +262,12 @@ static int meta_data_keys_to_json (char *buffer, size_t buffer_size, /* {{{ */ if (meta_data_get_string (meta, key, &value) == 0) { char temp[512] = ""; - json_escape_string (temp, sizeof (temp), value); + + status = json_escape_string (temp, sizeof (temp), value); sfree (value); + if (status != 0) + return status; + BUFFER_ADD (",\"%s\":%s", key, temp); } }