sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit e00f85aeb0db134f9d444522800cf83b3e158af0
parent f6b1522b348c9df8dd6f0d177466de1936bbce77
Author: Don Allen <donaldcallen@gmail.com>
Date:   Sun,  1 Jan 2012 08:21:37 -0500

Fix seg-fault in getbattery. The code failed to check for co == NULL after the first call to readline.
If NULL, a seg-fault would occur on the reference to co[0]. This change fixes that.
Diffstat:
Mdwm.suckless.org/dwmstatus/new-acpi-battery.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dwm.suckless.org/dwmstatus/new-acpi-battery.c b/dwm.suckless.org/dwmstatus/new-acpi-battery.c @@ -33,8 +33,8 @@ getbattery(char *base) remcap = -1; co = readfile(base, "present"); - if (co[0] != '1') { - free(co); + if (co == NULL || co[0] != '1') { + if (co != NULL) free(co); return smprintf("not present"); } free(co);