summaryrefslogtreecommitdiff
path: root/src/print_battery_info.c
diff options
context:
space:
mode:
authorIngo Bürk <admin@airblader.de>2018-06-22 13:55:09 +0200
committerGitHub <noreply@github.com>2018-06-22 13:55:09 +0200
commit4d3344ab9cd68bad5faf4ed3dad185dfcacb1e3d (patch)
tree66846b5f6023291fda2d72fe523d4ee0614d2a1f /src/print_battery_info.c
parent64fd6e10478cabd0e2f9b554b71971a865c02d60 (diff)
parentc221b4d331d46d07fe24afc78e4eeb021556d013 (diff)
Merge pull request #290 from duskCoder/changes
Fix potential issues & avoid unnecessary instructions
Diffstat (limited to 'src/print_battery_info.c')
-rw-r--r--src/print_battery_info.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/print_battery_info.c b/src/print_battery_info.c
index 7a462f7..04b5a25 100644
--- a/src/print_battery_info.c
+++ b/src/print_battery_info.c
@@ -450,14 +450,17 @@ static bool slurp_all_batteries(struct battery_info *batt_info, yajl_gen json_ge
.present_rate = 0,
.status = CS_UNKNOWN,
};
- if (!slurp_battery_info(&batt_buf, json_gen, buffer, i, globbuf.gl_pathv[i], format_down))
+ if (!slurp_battery_info(&batt_buf, json_gen, buffer, i, globbuf.gl_pathv[i], format_down)) {
+ globfree(&globbuf);
+ free(globpath);
return false;
+ }
is_found = true;
add_battery_info(batt_info, &batt_buf);
}
+ globfree(&globbuf);
}
- globfree(&globbuf);
free(globpath);
if (!is_found) {