summaryrefslogtreecommitdiff
path: root/src/print_battery_info.c
diff options
context:
space:
mode:
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) {