diff --git a/i3-config-wizard/main.c b/i3-config-wizard/main.c index 813be661..bd9aa28a 100644 --- a/i3-config-wizard/main.c +++ b/i3-config-wizard/main.c @@ -768,7 +768,7 @@ int main(int argc, char *argv[]) { switch (o) { case 's': FREE(socket_path); - socket_path = strdup(optarg); + socket_path = sstrdup(optarg); break; case 'v': printf("i3-config-wizard " I3_VERSION "\n"); diff --git a/i3-input/main.c b/i3-input/main.c index 6736aad3..cf3884e9 100644 --- a/i3-input/main.c +++ b/i3-input/main.c @@ -103,7 +103,7 @@ static void restore_input_focus(void) { * */ static uint8_t *concat_strings(char **glyphs, int max) { - uint8_t *output = calloc(max + 1, 4); + uint8_t *output = scalloc(max + 1, 4); uint8_t *walk = output; for (int c = 0; c < max; c++) { printf("at %c\n", glyphs[c][0]); @@ -187,10 +187,10 @@ static void finish_input() { /* allocate space for the output */ int inputlen = strlen(command); - char *full = calloc(1, - strlen(format) - (2 * cnt) /* format without all %s */ - + (inputlen * cnt) /* replaced %s */ - + 1); /* trailing NUL */ + char *full = scalloc(strlen(format) - (2 * cnt) /* format without all %s */ + + (inputlen * cnt) /* replaced %s */ + + 1, /* trailing NUL */ + 1); char *dest = full; for (c = 0; c < len; c++) { /* if this is not % or it is % but without a following 's', @@ -359,7 +359,7 @@ free_resources: } int main(int argc, char *argv[]) { - format = strdup("%s"); + format = sstrdup("%s"); socket_path = getenv("I3SOCK"); char *pattern = sstrdup("pango:monospace 8"); int o, option_index = 0; @@ -381,7 +381,7 @@ int main(int argc, char *argv[]) { switch (o) { case 's': FREE(socket_path); - socket_path = strdup(optarg); + socket_path = sstrdup(optarg); break; case 'v': printf("i3-input " I3_VERSION); @@ -401,11 +401,11 @@ int main(int argc, char *argv[]) { break; case 'f': FREE(pattern); - pattern = strdup(optarg); + pattern = sstrdup(optarg); break; case 'F': FREE(format); - format = strdup(optarg); + format = sstrdup(optarg); break; case 'h': printf("i3-input " I3_VERSION "\n"); diff --git a/i3-msg/main.c b/i3-msg/main.c index 3f195d41..47e7ae91 100644 --- a/i3-msg/main.c +++ b/i3-msg/main.c @@ -187,8 +187,7 @@ int main(int argc, char *argv[]) { payload = sstrdup(argv[optind]); } else { char *both; - if (asprintf(&both, "%s %s", payload, argv[optind]) == -1) - err(EXIT_FAILURE, "asprintf"); + sasprintf(&both, "%s %s", payload, argv[optind]); free(payload); payload = both; } diff --git a/i3-nagbar/main.c b/i3-nagbar/main.c index aca70ab1..d86cd69a 100644 --- a/i3-nagbar/main.c +++ b/i3-nagbar/main.c @@ -371,7 +371,7 @@ int main(int argc, char *argv[]) { if (argv0_len > strlen(".nagbar_cmd") && strcmp(argv[0] + argv0_len - strlen(".nagbar_cmd"), ".nagbar_cmd") == 0) { unlink(argv[0]); - cmd = strdup(argv[0]); + cmd = sstrdup(argv[0]); *(cmd + argv0_len - strlen(".nagbar_cmd")) = '\0'; execl("/bin/sh", "/bin/sh", cmd, NULL); err(EXIT_FAILURE, "execv(/bin/sh, /bin/sh, %s)", cmd); @@ -418,7 +418,7 @@ int main(int argc, char *argv[]) { printf("i3-nagbar [-m ] [-b