summaryrefslogtreecommitdiff
path: root/expr.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@open.eurogiciel.org>2014-12-17 11:17:33 +0100
committerJosé Bollo <jose.bollo@open.eurogiciel.org>2014-12-17 11:17:33 +0100
commit004a8b4fd3e6c6c592aba8dbafde5516c7bc1bef (patch)
treeba00ef9ff30529d421e76e035999849e4f94f8b2 /expr.c
parentf75acf01de7f4614a58c5b76021214bf243cf523 (diff)
downloadltrace-004a8b4fd3e6c6c592aba8dbafde5516c7bc1bef.tar.gz
ltrace-004a8b4fd3e6c6c592aba8dbafde5516c7bc1bef.tar.bz2
ltrace-004a8b4fd3e6c6c592aba8dbafde5516c7bc1bef.zip
Fix bug in `expr_clone`tizen_3.0_ivi_releasetizen_3.0.m2.a1_tv_releasetizen_3.0.m2.a1_mobile_releasetizen_3.0.m1_tv_releasetizen_3.0.m1_mobile_releasesubmit/tizen_wearable/20150128.000000submit/tizen_wearable/20150127.000001submit/tizen_tv/20150323.050640submit/tizen_tv/20150320.000002submit/tizen_tv/20150130.050505submit/tizen_mobile/20150223.000001submit/tizen_mobile/20150213.000000submit/tizen_mobile/20150129.000000submit/tizen_ivi/20160217.000006submit/tizen_ivi/20160217.000000submit/tizen_ivi/20141225.222222submit/tizen_common/20141218.170817submit/tizen_3.0_wearable/20161015.000004submit/tizen_3.0_tv/20161015.000004submit/tizen_3.0_mobile/20161015.000004submit/tizen_3.0_ivi/20161010.000004submit/tizen_3.0_common/20161104.104000submit/tizen_3.0.m2/20170104.093753accepted/tizen/wearable/20150129.005756accepted/tizen/tv/20150324.014607accepted/tizen/mobile/20150224.002805accepted/tizen/ivi/20160218.025301accepted/tizen/ivi/20141225.103508accepted/tizen/common/20141218.172009accepted/tizen/3.0/wearable/20161015.083719accepted/tizen/3.0/tv/20161016.005241accepted/tizen/3.0/mobile/20161015.033658accepted/tizen/3.0/ivi/20161011.050532accepted/tizen/3.0/common/20161114.111229accepted/tizen/3.0.m2/wearable/20170105.025026accepted/tizen/3.0.m2/tv/20170105.024857accepted/tizen/3.0.m2/mobile/20170105.024719tizen_3.0_tvtizen_3.0_ivitizen_3.0.m2tizen_3.0.m1_tvtizen_3.0.m1_mobiletizen_3.0.2015.q2_commontizen_3.0.2015.q1_commontizen_3.0.2014.q4_commontizen_3.0accepted/tizen_3.0_wearableaccepted/tizen_3.0_tvaccepted/tizen_3.0_mobileaccepted/tizen_3.0_iviaccepted/tizen_3.0_commonaccepted/tizen_3.0.m2_wearableaccepted/tizen_3.0.m2_tvaccepted/tizen_3.0.m2_mobile
On allocation failure of nhls for EXPR_OP_CALL2, EXPR_OP_UP, EXPR_OP_CALL1, the correct behaviour, that is returning -1, was only effective if node->kind == EXPR_OP_CALL2 and node->u.call.own_rhs This change implements the correct behaviour. It also solves a warning when compiling with gcc4.9 that broke integration when compiling with -Werror: the compiler was hurt to use nrhs that he suspected (wrongly) to be uninitialised. Change-Id: I184fea5e121d38fa1df5d0a8680edf51e9fff1a8 Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
Diffstat (limited to 'expr.c')
-rw-r--r--expr.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/expr.c b/expr.c
index 4059a32..3220509 100644
--- a/expr.c
+++ b/expr.c
@@ -229,21 +229,25 @@ expr_clone(struct expr_node *retp, const struct expr_node *node)
node->u.call.own_rhs) < 0)
return -1;
retp->u.call.rhs = nrhs;
- /* Fall through. */
- case EXPR_OP_UP:
- case EXPR_OP_CALL1:
if (expr_alloc_and_clone(&nlhs, node->lhs, node->own_lhs) < 0) {
- if (node->kind == EXPR_OP_CALL2
- && node->u.call.own_rhs) {
+ if (node->u.call.own_rhs) {
expr_destroy(nrhs);
free(nrhs);
- return -1;
}
+ return -1;
}
retp->lhs = nlhs;
return 0;
+
+ case EXPR_OP_UP:
+ case EXPR_OP_CALL1:
+ if (expr_alloc_and_clone(&nlhs, node->lhs, node->own_lhs) < 0)
+ return -1;
+
+ retp->lhs = nlhs;
+ return 0;
}
assert(!"Invalid value of node kind");