code: fix memory leak
This commit is contained in:
@@ -17,6 +17,7 @@ char tcph[] = {
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *json_file_path = "./fp.json";
|
||||
char *detail_json;
|
||||
|
||||
struct iphdr *l3_hdr = (struct iphdr *)iph;
|
||||
struct tcphdr *l4_hdr = (struct tcphdr *)tcph;
|
||||
@@ -27,7 +28,9 @@ int main(int argc, char **argv)
|
||||
struct osfp_result *result = osfp_ipv4_identify(db, l3_hdr, l4_hdr, l4_hdr_len);
|
||||
if (result) {
|
||||
printf("likely os: %s\n", osfp_result_os_name_get(result));
|
||||
printf("details: \n%s\n", osfp_result_score_detail_export(result));
|
||||
detail_json = osfp_result_score_detail_export(result);
|
||||
printf("details: \n%s\n", detail_json);
|
||||
free(detail_json);
|
||||
osfp_result_free(result);
|
||||
}
|
||||
osfp_db_free(db);
|
||||
|
||||
Reference in New Issue
Block a user