[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 3/4] libxenstat: always free qmp_stats
Originally qmp_stats is only freed in failure path and leaked in success path. Instead of wiring up the success path, rearrange the code a bit to always free qmp_stats before checking if info is NULL. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> Cc: Ian Campbell <ian.campbell@xxxxxxxxxx> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Cc: Charles Arnold <carnold@xxxxxxxx> --- tools/xenstat/libxenstat/src/xenstat_qmp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/xenstat/libxenstat/src/xenstat_qmp.c b/tools/xenstat/libxenstat/src/xenstat_qmp.c index 6bfbc2f..e4f343b 100644 --- a/tools/xenstat/libxenstat/src/xenstat_qmp.c +++ b/tools/xenstat/libxenstat/src/xenstat_qmp.c @@ -95,10 +95,10 @@ static char *qmp_get_block_image(xenstat_node *node, char *qmp_devname, int qfd) return NULL; /* Use libyajl version 2.0.3 or newer for the tree parser feature with bug fixes */ - if ((info = yajl_tree_parse((char *)qmp_stats, NULL, 0)) == NULL) { - free(qmp_stats); + info = yajl_tree_parse((char *)qmp_stats, NULL, 0); + free(qmp_stats); + if (info == NULL) return NULL; - } ptr[0] = qblock[QMP_BLOCK_RETURN]; /* "return" */ if ((ret_obj = yajl_tree_get(info, ptr, yajl_t_array)) == NULL) -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |