From: Jonas Fonseca Date: Wed, 2 Jun 2010 20:29:12 +0000 (-0400) Subject: Make argv_copy always allocate its members X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=117e270f1ff02b56302627331e8d97645012a2a0;p=tig.git Make argv_copy always allocate its members --- diff --git a/tig.c b/tig.c index 3121a3a..f364930 100644 --- a/tig.c +++ b/tig.c @@ -682,12 +682,12 @@ argv_free(const char *argv[]) } static bool -argv_copy(const char *dst[], const char *src[], bool allocate) +argv_copy(const char *dst[], const char *src[]) { int argc; for (argc = 0; src[argc]; argc++) - if (!(dst[argc] = allocate ? strdup(src[argc]) : src[argc])) + if (!(dst[argc] = strdup(src[argc]))) return FALSE; return TRUE; } @@ -1714,7 +1714,7 @@ add_run_request(enum keymap keymap, int key, int argc, const char **argv) req->key = key; req->argv[0] = NULL; - if (!argv_copy(req->argv, argv, TRUE)) + if (!argv_copy(req->argv, argv)) return REQ_NONE; return REQ_NONE + ++run_requests;