summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-06-28 11:51:52 -0400
committermidipix <writeonce@midipix.org>2018-06-29 01:37:43 -0400
commitb332ad32aa9c28702d3ce4d55d73ab7cabca0b24 (patch)
tree42b82a389b07c89b24b2a0708e50a3f0f49bec2a
parentc100d16db531b5ff2e252461ac50c63334108a22 (diff)
downloadslibtool-b332ad32aa9c28702d3ce4d55d73ab7cabca0b24.tar.bz2
slibtool-b332ad32aa9c28702d3ce4d55d73ab7cabca0b24.tar.xz
slbt_exec_link_adjust_argument_vector(): free depsmeta memory upon error.
-rw-r--r--src/logic/slbt_exec_link.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/logic/slbt_exec_link.c b/src/logic/slbt_exec_link.c
index e91ae98..749a224 100644
--- a/src/logic/slbt_exec_link.c
+++ b/src/logic/slbt_exec_link.c
@@ -272,7 +272,9 @@ static int slbt_exec_link_adjust_argument_vector(
argc += depsmeta->depscnt;
if (!(depsmeta->altv = calloc(argc,sizeof(char *))))
- return SLBT_SYSTEM_ERROR(dctx);
+ return slbt_exec_link_exit(
+ depsmeta,
+ SLBT_SYSTEM_ERROR(dctx));
carg = ectx->cargv;
aarg = depsmeta->altv;
@@ -352,7 +354,9 @@ static int slbt_exec_link_adjust_argument_vector(
rpathlnk,\
rpathdir,
sizeof(rpathdir)))
- return SLBT_SYSTEM_ERROR(dctx);
+ return slbt_exec_link_exit(
+ depsmeta,
+ SLBT_SYSTEM_ERROR(dctx));
sprintf(darg,"-Wl,%s",rpathdir);
*aarg++ = "-Wl,-rpath";
@@ -366,9 +370,12 @@ static int slbt_exec_link_adjust_argument_vector(
sprintf(lib,"%s.slibtool.deps",*carg);
/* account for {'-','L','-','l'} */
- if ((size_t)snprintf(arg,sizeof(arg),"%s",
- *carg) >= (sizeof(arg) - 4))
- return SLBT_BUFFER_ERROR(dctx);
+ if ((size_t)snprintf(arg,sizeof(arg),
+ "%s",*carg)
+ >= (sizeof(arg) - 4))
+ return slbt_exec_link_exit(
+ depsmeta,
+ SLBT_BUFFER_ERROR(dctx));
if ((slash = strrchr(arg,'/'))) {
sprintf(*carg,"-L%s",arg);
@@ -383,7 +390,9 @@ static int slbt_exec_link_adjust_argument_vector(
"DL_PATH=\"$DL_PATH$COLON%s/%s\"\n"
"COLON=':'\n\n",
cwd,arg) < 0)
- return SLBT_SYSTEM_ERROR(dctx);
+ return slbt_exec_link_exit(
+ depsmeta,
+ SLBT_SYSTEM_ERROR(dctx));
}
*aarg++ = *carg++;
@@ -440,7 +449,9 @@ static int slbt_exec_link_adjust_argument_vector(
&& (mark[1] == 'L')
&& (mark[2] != '/')) {
if (strlen(mark) >= sizeof(depdir) - 1)
- return SLBT_BUFFER_ERROR(dctx);
+ return slbt_exec_link_exit(
+ depsmeta,
+ SLBT_BUFFER_ERROR(dctx));
darg = mark;
strcpy(depdir,&mark[2]);
@@ -457,14 +468,20 @@ static int slbt_exec_link_adjust_argument_vector(
free(depsmeta->altv);
free(depsmeta->args);
fclose(fdeps);
- return SLBT_FILE_ERROR(dctx);
+
+ return slbt_exec_link_exit(
+ depsmeta,
+ SLBT_FILE_ERROR(dctx));
} else {
fclose(fdeps);
}
} else if (freqd) {
free(depsmeta->altv);
free(depsmeta->args);
- return SLBT_CUSTOM_ERROR(dctx,SLBT_ERR_LINK_FREQ);
+
+ return slbt_exec_link_exit(
+ depsmeta,
+ SLBT_CUSTOM_ERROR(dctx,SLBT_ERR_LINK_FREQ));
}
}
}