mirror of
https://github.com/sonertari/SSLproxy
synced 2024-10-31 21:20:21 +00:00
Make sure natengine is not NULL before freeing
This commit is contained in:
parent
674893cc79
commit
c3feea53f9
16
src/opts.c
16
src/opts.c
@ -817,8 +817,10 @@ proxyspec_set_target_addr(proxyspec_t *spec, char *addr, char *port, int af)
|
||||
return -1;
|
||||
}
|
||||
/* explicit target address */
|
||||
free(spec->natengine);
|
||||
spec->natengine = NULL;
|
||||
if (spec->natengine) {
|
||||
free(spec->natengine);
|
||||
spec->natengine = NULL;
|
||||
}
|
||||
#ifdef DEBUG_OPTS
|
||||
log_dbg_printf("TargetAddr: [%s]:%s\n", addr, port);
|
||||
#endif /* DEBUG_OPTS */
|
||||
@ -843,8 +845,10 @@ proxyspec_set_sni_port(proxyspec_t *spec, char *port)
|
||||
return -1;
|
||||
}
|
||||
spec->dns = 1;
|
||||
free(spec->natengine);
|
||||
spec->natengine = NULL;
|
||||
if (spec->natengine) {
|
||||
free(spec->natengine);
|
||||
spec->natengine = NULL;
|
||||
}
|
||||
#ifdef DEBUG_OPTS
|
||||
log_dbg_printf("SNIPort: %u\n", spec->sni_port);
|
||||
#endif /* DEBUG_OPTS */
|
||||
@ -856,8 +860,8 @@ proxyspec_set_natengine(proxyspec_t *spec, const char *natengine)
|
||||
{
|
||||
// Double checks if called by proxyspec_parse()
|
||||
if (nat_exist(natengine)) {
|
||||
/* natengine */
|
||||
free(spec->natengine);
|
||||
if (spec->natengine)
|
||||
free(spec->natengine);
|
||||
spec->natengine = strdup(natengine);
|
||||
if (!spec->natengine) {
|
||||
fprintf(stderr, "Out of memory\n");
|
||||
|
Loading…
Reference in New Issue
Block a user