Minor optimization in sdb_json_set, check for malloc