+ if (!s.len) {
+ free(s.buf);
+ return NULL;
+ }
+
+ ret = realloc(s.buf, s.pos + 1);
+ if (!ret) {
+ free(s.buf);
+ return NULL;
+ }
+
+ ret[s.pos] = 0;
+
+ return ret;
+}
+
+char *blobmsg_format_json_value_with_cb(struct blob_attr *attr, blobmsg_json_format_t cb, void *priv, int indent)
+{
+ struct strbuf s;
+ char *ret;
+
+ setup_strbuf(&s, attr, cb, priv, indent);
+ if (!s.buf)