aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-11-05 09:39:36 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-11-05 09:39:36 +0000
commit15b12f45c69751014f7a96f089ba32a76f97d4a6 (patch)
tree69db86171691ebf56bc9e4010a666a9161dbec90
parentserver/client: harden reading of initialization data, and make async (diff)
scan-build: fix a couple of minor warnings from a scan-build run
-rw-r--r--csi.c4
-rw-r--r--log.c2
-rw-r--r--main.c1
-rw-r--r--selection.c1
-rw-r--r--shm.c2
-rw-r--r--vt.c2
6 files changed, 7 insertions, 5 deletions
diff --git a/csi.c b/csi.c
index 1af30005..3ee46b70 100644
--- a/csi.c
+++ b/csi.c
@@ -54,8 +54,8 @@ csi_as_string(struct terminal *term, uint8_t final)
i == term->vt.params.idx - 1 ? "" : ";");
}
- c += snprintf(&msg[c], sizeof(msg) - c, "%c (%zu parameters)",
- final, term->vt.params.idx);
+ snprintf(&msg[c], sizeof(msg) - c, "%c (%zu parameters)",
+ final, term->vt.params.idx);
return msg;
}
diff --git a/log.c b/log.c
index 87059351..e046cd79 100644
--- a/log.c
+++ b/log.c
@@ -100,7 +100,7 @@ _sys_log(enum log_class log_class, const char *module,
idx += vsnprintf(&msg[idx], required_len + 1 - idx, fmt, va);
if (sys_errno != 0) {
- idx += snprintf(
+ snprintf(
&msg[idx], required_len + 1 - idx, ": %s", strerror(sys_errno));
}
diff --git a/main.c b/main.c
index 53f361ed..903d0080 100644
--- a/main.c
+++ b/main.c
@@ -143,6 +143,7 @@ main(int argc, char *const *argv)
unsigned width, height;
if (sscanf(optarg, "%ux%u", &width, &height) != 2 || width == 0 || height == 0) {
fprintf(stderr, "error: invalid geometry: %s\n", optarg);
+ config_free(conf);
return EXIT_FAILURE;
}
diff --git a/selection.c b/selection.c
index e9fa55d5..2a05b853 100644
--- a/selection.c
+++ b/selection.c
@@ -108,6 +108,7 @@ extract_selection(const struct terminal *term)
start_col = 0;
}
+ assert(idx > 0);
assert(idx < buf_size);
if (buf[idx - 1] == '\n')
buf[idx - 1] = '\0';
diff --git a/shm.c b/shm.c
index 26e58167..356288bc 100644
--- a/shm.c
+++ b/shm.c
@@ -148,7 +148,7 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie)
/* We use the entire pool for our single buffer */
wl_shm_pool_destroy(pool); pool = NULL;
- close(pool_fd); pool_fd = -1;
+ close(pool_fd);
/* One pixman image for each worker thread (do we really need multiple?) */
pix = pixman_image_create_bits_no_clear(
diff --git a/vt.c b/vt.c
index 41524857..aa61bcc9 100644
--- a/vt.c
+++ b/vt.c
@@ -581,7 +581,7 @@ esc_as_string(struct terminal *term, uint8_t final)
assert(term->vt.params.idx == 0);
- c += snprintf(&msg[c], sizeof(msg) - c, "%c", final);
+ snprintf(&msg[c], sizeof(msg) - c, "%c", final);
return msg;
}