Skip to content

Commit

Permalink
never free resconf passed to confserver_cb
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Mauchle committed Jun 26, 2018
1 parent 67a5f2e commit 057f97a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
- Fix refcounting in error cases when loading configuration (RADSECPROXY-42)
- Fix potential crash when rewriting malformed vendor attributes.
- Properly cleanup expired requests from server output-queue.
- Fix crash when dynamic discovered server doesn't resolve.

2017-08-02 1.6.9
Misc:
Expand Down
23 changes: 13 additions & 10 deletions radsecproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2911,7 +2911,7 @@ int confserver_cb(struct gconffile **cf, void *arg, char *block, char *opt, char
struct clsrvconf *conf, *resconf;
char *conftype = NULL, *rewriteinalias = NULL;
long int retryinterval = LONG_MIN, retrycount = LONG_MIN, addttl = LONG_MIN;
uint8_t ipv4only = 0, ipv6only = 0;
uint8_t ipv4only = 0, ipv6only = 0, confmerged = 0;

debug(DBG_DBG, "confserver_cb called for %s", block);

Expand Down Expand Up @@ -3023,14 +3023,15 @@ int confserver_cb(struct gconffile **cf, void *arg, char *block, char *opt, char
}

if (resconf) {
if (!mergesrvconf(resconf, conf))
goto errexit;
free(conf);
conf = resconf;
if (conf->dynamiclookupcommand) {
free(conf->dynamiclookupcommand);
conf->dynamiclookupcommand = NULL;
}
if (!mergesrvconf(resconf, conf))
goto errexit;
free(conf);
conf = resconf;
confmerged = 1;
if (conf->dynamiclookupcommand) {
free(conf->dynamiclookupcommand);
conf->dynamiclookupcommand = NULL;
}
}

if (resconf || !conf->dynamiclookupcommand) {
Expand Down Expand Up @@ -3062,7 +3063,9 @@ int confserver_cb(struct gconffile **cf, void *arg, char *block, char *opt, char
errexit:
free(conftype);
free(rewriteinalias);
freeclsrvconf(conf);
/* if conf was merged into resconf, don't free it */
if (!confmerged)
freeclsrvconf(conf);
return 0;
}

Expand Down

0 comments on commit 057f97a

Please sign in to comment.