malloc/free: some more cleaning & checking malloc errors

This commit is contained in:
Philippe Teuwen
2013-03-02 02:50:33 +01:00
parent 0708279215
commit a6c405a5d5
4 changed files with 46 additions and 0 deletions

View File

@@ -1287,6 +1287,8 @@ int
str_nfc_target(char **buf, const nfc_target nt, bool verbose)
{
*buf = malloc(4096);
if (! *buf)
return NFC_ESOFT;
(*buf)[0] = '\0';
sprint_nfc_target(*buf, nt, verbose);
return strlen(*buf);