fix: leak
This commit is contained in:
@ -63,8 +63,10 @@ int main(int ac, char **av)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_interface_name(&general.host) < 0)
|
if (get_interface_name(&general.host) < 0) {
|
||||||
|
free_options(options);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
char *nb_threads_str = get_option_arg(options, FL_SPEEDUP);
|
char *nb_threads_str = get_option_arg(options, FL_SPEEDUP);
|
||||||
uint8_t nb_threads = 0;
|
uint8_t nb_threads = 0;
|
||||||
|
@ -229,10 +229,11 @@ struct option_lst *parse_options(int ac, char *const *av)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (check_arg(option_index, optarg) < 0)
|
if (check_arg(option_index, optarg) < 0 || add_option(&head, option_index, optarg) < 0)
|
||||||
return NULL;
|
{
|
||||||
if (add_option(&head, option_index, optarg) < 0)
|
free_options(head);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return head;
|
return head;
|
||||||
}
|
}
|
||||||
@ -259,12 +260,5 @@ int parsing(struct scan *general, const struct option_lst *options)
|
|||||||
general->max_retries = max_retries ? atoi(max_retries) : 1;
|
general->max_retries = max_retries ? atoi(max_retries) : 1;
|
||||||
const char *ttl = get_option_arg(options, FL_TTL);
|
const char *ttl = get_option_arg(options, FL_TTL);
|
||||||
general->ttl = ttl ? atoi(ttl) : 48;
|
general->ttl = ttl ? atoi(ttl) : 48;
|
||||||
const char *nb_threads_str = get_option_arg(options, FL_SPEEDUP);
|
|
||||||
uint8_t nb_threads = nb_threads_str ? atoi(nb_threads_str) : 0;
|
|
||||||
if (general->port_end - general->port_start + 1 < nb_threads) {
|
|
||||||
dprintf(2, "ft_nmap: number of threads to use must be "
|
|
||||||
"superior "
|
|
||||||
"or equals to the ports range\n");
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user