Merge pull request #416 from orestisfl/memleak
Fix various memory leaks
This commit is contained in:
commit
a1ed46a18a
@ -35,7 +35,6 @@ addons:
|
|||||||
- libcap2-bin
|
- libcap2-bin
|
||||||
- pulseaudio
|
- pulseaudio
|
||||||
script:
|
script:
|
||||||
# TODO: re-enable sanitizers once issues are fixed
|
- autoreconf -fi && mkdir -p build && cd build && (../configure || (cat config.log; false)) && make -j 8 V=1 && ldd ./i3status |& grep -q pulse || (echo "not linked against pulseaudio"; exit 1)
|
||||||
- autoreconf -fi && mkdir -p build && cd build && (../configure --disable-sanitizers || (cat config.log; false)) && make -j 8 V=1 && ldd ./i3status |& grep -q pulse || (echo "not linked against pulseaudio"; exit 1)
|
- make clean && (../configure --enable-sanitizers --disable-pulseaudio || (cat config.log; false)) && make -j 8 V=1 && ldd ./i3status |& grep -q pulse && (echo "linked against pulseaudio"; exit 1) || true
|
||||||
- make clean && (../configure --disable-sanitizers --disable-pulseaudio || (cat config.log; false)) && make -j 8 V=1 && ldd ./i3status |& grep -q pulse && (echo "linked against pulseaudio"; exit 1) || true
|
|
||||||
- make -j 8 check V=1 || (cat test-suite.log; false)
|
- make -j 8 check V=1 || (cat test-suite.log; false)
|
||||||
|
@ -207,6 +207,7 @@ static char *get_config_path(void) {
|
|||||||
config_path = resolve_tilde("~/.i3status.conf");
|
config_path = resolve_tilde("~/.i3status.conf");
|
||||||
if (path_exists(config_path))
|
if (path_exists(config_path))
|
||||||
return config_path;
|
return config_path;
|
||||||
|
free(config_path);
|
||||||
char *buf = strdup(xdg_config_dirs);
|
char *buf = strdup(xdg_config_dirs);
|
||||||
char *tok = strtok(buf, ":");
|
char *tok = strtok(buf, ":");
|
||||||
while (tok != NULL) {
|
while (tok != NULL) {
|
||||||
@ -230,7 +231,6 @@ static char *get_config_path(void) {
|
|||||||
|
|
||||||
die("Unable to find the configuration file (looked at "
|
die("Unable to find the configuration file (looked at "
|
||||||
"~/.i3status.conf, $XDG_CONFIG_HOME/i3status/config, " SYSCONFDIR "/i3status.conf and $XDG_CONFIG_DIRS/i3status/config)");
|
"~/.i3status.conf, $XDG_CONFIG_HOME/i3status/config, " SYSCONFDIR "/i3status.conf and $XDG_CONFIG_DIRS/i3status/config)");
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -807,4 +807,6 @@ int main(int argc, char *argv[]) {
|
|||||||
struct timespec ts = {interval - 1 - (current_timeval.tv_sec % interval), (10e5 - current_timeval.tv_usec) * 1000};
|
struct timespec ts = {interval - 1 - (current_timeval.tv_sec % interval), (10e5 - current_timeval.tv_usec) * 1000};
|
||||||
nanosleep(&ts, NULL);
|
nanosleep(&ts, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
yajl_gen_free(json_gen);
|
||||||
}
|
}
|
||||||
|
@ -173,4 +173,5 @@ void print_ddate(yajl_gen json_gen, char *buffer, const char *format, time_t t)
|
|||||||
const size_t num = sizeof(placeholders) / sizeof(placeholder_t);
|
const size_t num = sizeof(placeholders) / sizeof(placeholder_t);
|
||||||
buffer = format_placeholders(format, &placeholders[0], num);
|
buffer = format_placeholders(format, &placeholders[0], num);
|
||||||
OUTPUT_FULL_TEXT(buffer);
|
OUTPUT_FULL_TEXT(buffer);
|
||||||
|
free(buffer);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// vim:ts=4:sw=4:expandtab
|
// vim:ts=4:sw=4:expandtab
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <yajl/yajl_gen.h>
|
#include <yajl/yajl_gen.h>
|
||||||
#include <yajl/yajl_version.h>
|
#include <yajl/yajl_version.h>
|
||||||
@ -35,4 +36,5 @@ void print_run_watch(yajl_gen json_gen, char *buffer, const char *title, const c
|
|||||||
|
|
||||||
END_COLOR;
|
END_COLOR;
|
||||||
OUTPUT_FULL_TEXT(buffer);
|
OUTPUT_FULL_TEXT(buffer);
|
||||||
|
free(buffer);
|
||||||
}
|
}
|
||||||
|
@ -82,4 +82,7 @@ void print_time(yajl_gen json_gen, char *buffer, const char *title, const char *
|
|||||||
out:
|
out:
|
||||||
*outwalk = '\0';
|
*outwalk = '\0';
|
||||||
OUTPUT_FULL_TEXT(buffer);
|
OUTPUT_FULL_TEXT(buffer);
|
||||||
|
if (format_time != NULL) {
|
||||||
|
free(buffer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user