From 334f09a65b7ce53bc096e7387ac640d15b8c5737 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Tue, 4 Feb 2020 21:16:16 +0000 Subject: [PATCH] libelftc: Add a missing check for an error from vector_str_init(). While here consistently use the same spelling for such checks. CID: 1376769 MFC after: 1 week Sponsored by: The FreeBSD Foundation --- contrib/elftoolchain/libelftc/libelftc_dem_arm.c | 5 ++--- contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c | 5 ++--- contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c | 5 +++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/contrib/elftoolchain/libelftc/libelftc_dem_arm.c b/contrib/elftoolchain/libelftc/libelftc_dem_arm.c index 4fe94eac2171..ec87f6f7a11b 100644 --- a/contrib/elftoolchain/libelftc/libelftc_dem_arm.c +++ b/contrib/elftoolchain/libelftc/libelftc_dem_arm.c @@ -303,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); } diff --git a/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c b/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c index c685e6b18144..a414c7cdab80 100644 --- a/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c +++ b/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c @@ -389,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); } diff --git a/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c b/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c index 73ed371a1cfc..8127919f1cf6 100644 --- a/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c +++ b/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c @@ -1659,7 +1659,8 @@ cpp_demangle_read_local_name(struct cpp_demangle_data *ddata) 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_qualifier *v) 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); }