svn commit: r357751 - stable/12/contrib/elftoolchain/libelftc
Mark Johnston
markj at FreeBSD.org
Tue Feb 11 05:11:29 UTC 2020
Author: markj
Date: Tue Feb 11 05:11:27 2020
New Revision: 357751
URL: https://svnweb.freebsd.org/changeset/base/357751
Log:
MFC r357535, r357536:
libelftc: Fix memory leaks in the C++ demanglers.
Modified:
stable/12/contrib/elftoolchain/libelftc/libelftc_dem_arm.c
stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c
stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/contrib/elftoolchain/libelftc/libelftc_dem_arm.c
==============================================================================
--- stable/12/contrib/elftoolchain/libelftc/libelftc_dem_arm.c Tue Feb 11 04:05:45 2020 (r357750)
+++ stable/12/contrib/elftoolchain/libelftc/libelftc_dem_arm.c Tue Feb 11 05:11:27 2020 (r357751)
@@ -203,11 +203,13 @@ cpp_demangle_ARM(const char *org)
break;
if ((arg = vector_str_substr(&d.vec, arg_begin, d.vec.size - 1,
- &arg_len)) == NULL)
+ &arg_len)) == NULL)
goto clean;
- if (vector_str_push(&d.arg, arg, arg_len) == false)
+ if (vector_str_push(&d.arg, arg, arg_len) == false) {
+ free(arg);
goto clean;
+ }
free(arg);
@@ -301,12 +303,11 @@ init_demangle_data(struct demangle_data *d)
d->type = ENCODE_FUNC;
- if (vector_str_init(&d->vec) == false)
+ if (!vector_str_init(&d->vec))
return (false);
- if (vector_str_init(&d->arg) == false) {
+ if (!vector_str_init(&d->arg)) {
vector_str_dest(&d->vec);
-
return (false);
}
@@ -956,7 +957,7 @@ read_op_user(struct demangle_data *d)
goto clean;
if (VEC_PUSH_STR(&d->vec, "::operator ") == false)
- return (false);
+ goto clean;
if (vector_str_push(&d->vec, to_str, to_len) == false)
goto clean;
Modified: stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c
==============================================================================
--- stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c Tue Feb 11 04:05:45 2020 (r357750)
+++ stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c Tue Feb 11 05:11:27 2020 (r357751)
@@ -216,11 +216,13 @@ cpp_demangle_gnu2(const char *org)
break;
if ((arg = vector_str_substr(&d.vec, arg_begin, d.vec.size - 1,
- &arg_len)) == NULL)
+ &arg_len)) == NULL)
goto clean;
- if (vector_str_push(&d.arg, arg, arg_len) == false)
+ if (vector_str_push(&d.arg, arg, arg_len) == false) {
+ free(arg);
goto clean;
+ }
free(arg);
@@ -387,12 +389,11 @@ init_demangle_data(struct demangle_data *d)
d->type = ENCODE_FUNC;
- if (vector_str_init(&d->vec) == false)
+ if (!vector_str_init(&d->vec))
return (false);
- if (vector_str_init(&d->arg) == false) {
+ if (!vector_str_init(&d->arg)) {
vector_str_dest(&d->vec);
-
return (false);
}
Modified: stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c
==============================================================================
--- stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c Tue Feb 11 04:05:45 2020 (r357750)
+++ stable/12/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c Tue Feb 11 05:11:27 2020 (r357751)
@@ -1659,7 +1659,8 @@ cpp_demangle_read_local_name(struct cpp_demangle_data
if (*(++ddata->cur) == '\0')
return (0);
- vector_str_init(&local_name);
+ if (!vector_str_init(&local_name))
+ return (0);
ddata->cur_output = &local_name;
if (!cpp_demangle_read_encoding(ddata)) {
@@ -3953,7 +3954,7 @@ vector_type_qualifier_init(struct vector_type_qualifie
assert(v->q_container != NULL);
- if (vector_str_init(&v->ext_name) == false) {
+ if (!vector_str_init(&v->ext_name)) {
free(v->q_container);
return (0);
}
More information about the svn-src-stable-12
mailing list