From: Sebastian Harl Date: Sat, 2 Aug 2014 10:59:44 +0000 (+0200) Subject: store_expr: Fixed a memory leak in an error condition. X-Git-Tag: sysdb-0.4.0~52 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6fbca0cdf68f596a6711fa6b09aa39e35aade71f;p=sysdb.git store_expr: Fixed a memory leak in an error condition. --- diff --git a/src/core/store_expr.c b/src/core/store_expr.c index 9aa1ce9..caf3aa6 100644 --- a/src/core/store_expr.c +++ b/src/core/store_expr.c @@ -162,6 +162,7 @@ sdb_store_expr_eval(sdb_store_expr_t *expr, sdb_store_obj_t *obj, sdb_data_t *res) { sdb_data_t v1 = SDB_DATA_INIT, v2 = SDB_DATA_INIT; + int status = 0; if ((! expr) || (! res)) return -1; @@ -178,12 +179,11 @@ sdb_store_expr_eval(sdb_store_expr_t *expr, sdb_store_obj_t *obj, return -1; } - if (sdb_data_expr_eval(expr->type, &v1, &v2, res)) { - sdb_data_free_datum(&v1); - sdb_data_free_datum(&v2); - return -1; - } - return 0; + if (sdb_data_expr_eval(expr->type, &v1, &v2, res)) + status = -1; + sdb_data_free_datum(&v1); + sdb_data_free_datum(&v2); + return status; } /* sdb_store_expr_eval */ /* vim: set tw=78 sw=4 ts=4 noexpandtab : */