summaryrefslogtreecommitdiff
path: root/i3status.c
diff options
context:
space:
mode:
Diffstat (limited to 'i3status.c')
-rw-r--r--i3status.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/i3status.c b/i3status.c
index 558f8ab..5088c96 100644
--- a/i3status.c
+++ b/i3status.c
@@ -111,6 +111,9 @@ static void *scalloc(size_t size) {
}
char *sstrdup(const char *str) {
+ if (str == NULL) {
+ return NULL;
+ }
char *result = strdup(str);
exit_if_null(result, "Error: out of memory (strdup())\n");
return result;
@@ -628,6 +631,11 @@ int main(int argc, char *argv[]) {
die("Could not create socket\n");
int interval = cfg_getint(cfg_general, "interval");
+ if (interval <= 0) {
+ die("Invalid interval attribute found in section %s, line %d: %d\n"
+ "Expected positive integer\n",
+ cfg_general->name, cfg_general->line, interval);
+ }
/* One memory page which each plugin can use to buffer output.
* Even though it’s unclean, we just assume that the user will not