Skip to content
Snippets Groups Projects
Commit 8b166a9b authored by Daniel Kahn Gillmor's avatar Daniel Kahn Gillmor Committed by Marek Vavrusa
Browse files

remove asprintf warnings

parent 6b0b73b3
No related branches found
No related tags found
No related merge requests found
......@@ -192,9 +192,11 @@ static char* prune(void *env, struct kr_module *module, const char *args)
char *result = NULL;
ret = kr_cache_txn_commit(&txn);
if (ret != 0) {
asprintf(&result, "{ \"pruned\": %d, \"error\": \"%s\" }", pruned, knot_strerror(ret));
if (-1 == asprintf(&result, "{ \"pruned\": %d, \"error\": \"%s\" }", pruned, knot_strerror(ret)))
result = NULL;
} else {
asprintf(&result, "{ \"pruned\": %d }", pruned);
if (-1 == asprintf(&result, "{ \"pruned\": %d }", pruned))
result = NULL;
}
return result;
......
......@@ -329,7 +329,8 @@ static char* hint_set(void *env, struct kr_module *module, const char *args)
}
char *result = NULL;
asprintf(&result, "{ \"result\": %s", ret == 0 ? "true" : "false");
if (-1 == asprintf(&result, "{ \"result\": %s }", ret == 0 ? "true" : "false"))
result = NULL;
return result;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment