summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-04-19 11:44:38 -0400
committermidipix <writeonce@midipix.org>2016-04-19 14:17:31 -0400
commit52556c7d6514382cf92faec5ac33e08c781113fa (patch)
treea26c3318310143ef545f3bd7b85ef7f16ed2beee /src
parent1f442fbd829d9b3d93e513a94047eb018da989ff (diff)
downloadslibtool-52556c7d6514382cf92faec5ac33e08c781113fa.tar.bz2
slibtool-52556c7d6514382cf92faec5ac33e08c781113fa.tar.xz
driver: allow freeing of alternate host strings.
Diffstat (limited to 'src')
-rw-r--r--src/driver/slbt_driver_ctx.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index 29afbbe..eac0ac6 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -425,6 +425,24 @@ static int slbt_init_host_params(
return 0;
}
+static void slbt_free_host_params(struct slbt_host_strs * host)
+{
+ if (host->host)
+ free(host->host);
+
+ if (host->flavor)
+ free(host->flavor);
+
+ if (host->ar)
+ free(host->ar);
+
+ if (host->ranlib)
+ free(host->ranlib);
+
+ if (host->dlltool)
+ free(host->dlltool);
+}
+
static void slbt_init_flavor_settings(
struct slbt_common_ctx * cctx,
const struct slbt_host_params * ahost,
@@ -874,21 +892,7 @@ static void slbt_free_driver_ctx_impl(struct slbt_driver_ctx_alloc * ictx)
if (ictx->ctx.libname)
free(ictx->ctx.libname);
- if (ictx->ctx.host.host)
- free(ictx->ctx.host.host);
-
- if (ictx->ctx.host.flavor)
- free(ictx->ctx.host.flavor);
-
- if (ictx->ctx.host.ar)
- free(ictx->ctx.host.ar);
-
- if (ictx->ctx.host.ranlib)
- free(ictx->ctx.host.ranlib);
-
- if (ictx->ctx.host.dlltool)
- free(ictx->ctx.host.dlltool);
-
+ slbt_free_host_params(&ictx->ctx.host);
argv_free(ictx->meta);
free(ictx);
}