svn commit: r357535 - head/contrib/elftoolchain/libelftc
Mark Johnston
markj at FreeBSD.org
Tue Feb 4 21:15:53 UTC 2020
Author: markj
Date: Tue Feb 4 21:15:52 2020
New Revision: 357535
URL: https://svnweb.freebsd.org/changeset/base/357535
Log:
libelftc: Fix memory leaks in the C++ demanglers.
CID: 1262518, 1262519, 1262520, 1262529
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Modified:
head/contrib/elftoolchain/libelftc/libelftc_dem_arm.c
head/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c
Modified: head/contrib/elftoolchain/libelftc/libelftc_dem_arm.c
==============================================================================
--- head/contrib/elftoolchain/libelftc/libelftc_dem_arm.c Tue Feb 4 21:15:29 2020 (r357534)
+++ head/contrib/elftoolchain/libelftc/libelftc_dem_arm.c Tue Feb 4 21:15:52 2020 (r357535)
@@ -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);
@@ -956,7 +958,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: head/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c
==============================================================================
--- head/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c Tue Feb 4 21:15:29 2020 (r357534)
+++ head/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c Tue Feb 4 21:15:52 2020 (r357535)
@@ -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);
More information about the svn-src-all
mailing list