{"thread":{"id":"19810","subject":"[PATCH] avoid NULL dereference on failed malloc","startedAt":"2009-06-14T19:46:10Z","lastAt":"2009-06-22T22:27:44Z","messageCount":9,"participants":["Jim Meyering","Michael J Gruber","Bert Wesarg","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"116284","messageId":"87hbyioayl.fsf@meyering.net","threadId":"19810","inReplyTo":null,"subject":"[PATCH] avoid NULL dereference on failed malloc","fromName":"Jim Meyering","fromEmail":"jim@meyering.net","sentAt":"2009-06-14T19:46:10Z","receivedAt":"2009-06-14T19:46:10Z","isPatch":true,"sender":{"key":"jim@meyering.net","avatar":"https://avatars.githubusercontent.com/u/710630?v=4"},"body":"\n* builtin-remote.c (get_one_entry): Use xmalloc, not malloc.\n\nSigned-off-by: Jim Meyering <meyering@redhat.com>\n---\n builtin-remote.c |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin-remote.c b/builtin-remote.c\nindex 709f8a6..406fb85 100644\n--- a/builtin-remote.c\n+++ b/builtin-remote.c\n@@ -1282,7 +1282,7 @@ static int get_one_entry(struct remote *remote, void *priv)\n\n \tif (remote->url_nr > 0) {\n \t\tutilp = &(string_list_append(remote->name, list)->util);\n-\t\t*utilp = malloc(strlen(remote->url[0])+strlen(\" (fetch)\")+1);\n+\t\t*utilp = xmalloc(strlen(remote->url[0])+strlen(\" (fetch)\")+1);\n \t\tstrcpy((char *) *utilp, remote->url[0]);\n \t\tstrcat((char *) *utilp, \" (fetch)\");\n \t} else\n@@ -1297,7 +1297,7 @@ static int get_one_entry(struct remote *remote, void *priv)\n \tfor (i = 0; i < url_nr; i++)\n \t{\n \t\tutilp = &(string_list_append(remote->name, list)->util);\n-\t\t*utilp = malloc(strlen(url[i])+strlen(\" (push)\")+1);\n+\t\t*utilp = xmalloc(strlen(url[i])+strlen(\" (push)\")+1);\n \t\tstrcpy((char *) *utilp, url[i]);\n \t\tstrcat((char *) *utilp, \" (push)\");\n \t}\n--\n1.6.3.2.406.gd6a466\n"},{"id":"116319","messageId":"4A35FCFB.1080000@drmicha.warpmail.net","threadId":"19810","inReplyTo":"87hbyioayl.fsf@meyering.net","subject":"Re: [PATCH] avoid NULL dereference on failed malloc","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-06-15T07:49:15Z","receivedAt":"2009-06-15T07:49:15Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Jim Meyering venit, vidit, dixit 14.06.2009 21:46:\n> \n> * builtin-remote.c (get_one_entry): Use xmalloc, not malloc.\n\nLearning something new with every patch... Sorry, Junio; thanks, Jim!\n\nMichael\n"},{"id":"116352","messageId":"1245098728-7502-1-git-send-email-bert.wesarg@googlemail.com","threadId":"19810","inReplyTo":"4A35FCFB.1080000@drmicha.warpmail.net","subject":"[PATCH] builtin-remote: (get_one_entry): use strbuf","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2009-06-15T20:45:28Z","receivedAt":"2009-06-15T20:45:28Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n\nOn Mon, Jun 15, 2009 at 09:49, Michael J Gruber<git@drmicha.warpmail.net> wrote:\n> Jim Meyering venit, vidit, dixit 14.06.2009 21:46:\n>>\n>> * builtin-remote.c (get_one_entry): Use xmalloc, not malloc.\n>\n> Learning something new with every patch... Sorry, Junio; thanks, Jim!\n>\nOne more reason to re-use existing string handling functions.\n\nRegards,\nBert\n\n builtin-remote.c |   21 ++++++++++-----------\n 1 files changed, 10 insertions(+), 11 deletions(-)\n\ndiff --git a/builtin-remote.c b/builtin-remote.c\nindex 709f8a6..31adeaa 100644\n--- a/builtin-remote.c\n+++ b/builtin-remote.c\n@@ -1276,17 +1276,17 @@ static int update(int argc, const char **argv)\n static int get_one_entry(struct remote *remote, void *priv)\n {\n \tstruct string_list *list = priv;\n+\tstruct strbuf url_buf = STRBUF_INIT;\n+\tconst char *url_str = NULL;\n \tconst char **url;\n \tint i, url_nr;\n-\tvoid **utilp;\n \n \tif (remote->url_nr > 0) {\n-\t\tutilp = &(string_list_append(remote->name, list)->util);\n-\t\t*utilp = xmalloc(strlen(remote->url[0])+strlen(\" (fetch)\")+1);\n-\t\tstrcpy((char *) *utilp, remote->url[0]);\n-\t\tstrcat((char *) *utilp, \" (fetch)\");\n-\t} else\n-\t\tstring_list_append(remote->name, list)->util = NULL;\n+\t\tstrbuf_addf(&url_buf, \"%s (fetch)\", remote->url[0]);\n+\t\turl_str = strbuf_detach(&url_buf, NULL);\n+\t}\n+\tstring_list_append(remote->name, list)->util = url_str;\n+\n \tif (remote->pushurl_nr) {\n \t\turl = remote->pushurl;\n \t\turl_nr = remote->pushurl_nr;\n@@ -1296,10 +1296,9 @@ static int get_one_entry(struct remote *remote, void *priv)\n \t}\n \tfor (i = 0; i < url_nr; i++)\n \t{\n-\t\tutilp = &(string_list_append(remote->name, list)->util);\n-\t\t*utilp = xmalloc(strlen(url[i])+strlen(\" (push)\")+1);\n-\t\tstrcpy((char *) *utilp, url[i]);\n-\t\tstrcat((char *) *utilp, \" (push)\");\n+\t\tstrbuf_addf(&url_buf, \"%s (push)\", url[i]);\n+\t\turl_str = strbuf_detach(&url_buf, NULL);\n+\t\tstring_list_append(remote->name, list)->util = url_str;\n \t}\n \n \treturn 0;\n-- \ntg: (d6a466e..) bw/remote-v-use-strbuf (depends on: next)\n"},{"id":"116392","messageId":"4A374C4E.2090304@drmicha.warpmail.net","threadId":"19810","inReplyTo":"1245098728-7502-1-git-send-email-bert.wesarg@googlemail.com","subject":"Re: [PATCH] builtin-remote: (get_one_entry): use strbuf","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-06-16T07:39:58Z","receivedAt":"2009-06-16T07:39:58Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Bert Wesarg venit, vidit, dixit 15.06.2009 22:45:\n> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n> \n> ---\n> \n> On Mon, Jun 15, 2009 at 09:49, Michael J Gruber<git@drmicha.warpmail.net> wrote:\n>> Jim Meyering venit, vidit, dixit 14.06.2009 21:46:\n>>>\n>>> * builtin-remote.c (get_one_entry): Use xmalloc, not malloc.\n>>\n>> Learning something new with every patch... Sorry, Junio; thanks, Jim!\n>>\n> One more reason to re-use existing string handling functions.\n\nWell, when we discussed this before v2 I asked for guidance about\nstrbuf, esp. regarding the issue of allocating/freeing. From your patch\nI infer that \"strbuf_detach\" is what I was looking for. (And yes, it is\nin the api doc where I overlooked it.)\n\n>  builtin-remote.c |   21 ++++++++++-----------\n>  1 files changed, 10 insertions(+), 11 deletions(-)\n>\n> diff --git a/builtin-remote.c b/builtin-remote.c\n> index 709f8a6..31adeaa 100644\n> --- a/builtin-remote.c\n> +++ b/builtin-remote.c\n\nFor whatever reason, your patch does not apply (am) here on top of next\n+ Jim's patch. Given the context (xmallocs), it looks like it's against\nsomething + Jim's patch. OTOH: 709f8a6 show's a get_one_entry with\nmallocs. Did you hand edit the diff?\n\nMichael\n"},{"id":"116395","messageId":"36ca99e90906160056w4f892dc7n761b7e7fb91a288d@mail.gmail.com","threadId":"19810","inReplyTo":"4A374C4E.2090304@drmicha.warpmail.net","subject":"Re: [PATCH] builtin-remote: (get_one_entry): use strbuf","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2009-06-16T07:56:41Z","receivedAt":"2009-06-16T07:56:41Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Tue, Jun 16, 2009 at 09:39, Michael J Gruber<git@drmicha.warpmail.net> wrote:\n> Bert Wesarg venit, vidit, dixit 15.06.2009 22:45:\n>> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>>\n>> ---\n>>\n>> On Mon, Jun 15, 2009 at 09:49, Michael J Gruber<git@drmicha.warpmail.net> wrote:\n>>> Jim Meyering venit, vidit, dixit 14.06.2009 21:46:\n>>>>\n>>>> * builtin-remote.c (get_one_entry): Use xmalloc, not malloc.\n>>>\n>>> Learning something new with every patch... Sorry, Junio; thanks, Jim!\n>>>\n>> One more reason to re-use existing string handling functions.\n>\n> Well, when we discussed this before v2 I asked for guidance about\n> strbuf, esp. regarding the issue of allocating/freeing.\nWell, I stopped reading after this question of yours: \"But what do\nstrbufs bring us here?\"\n\n> From your patch\n> I infer that \"strbuf_detach\" is what I was looking for. (And yes, it is\n> in the api doc where I overlooked it.)\n>\n>>  builtin-remote.c |   21 ++++++++++-----------\n>>  1 files changed, 10 insertions(+), 11 deletions(-)\n>>\n>> diff --git a/builtin-remote.c b/builtin-remote.c\n>> index 709f8a6..31adeaa 100644\n>> --- a/builtin-remote.c\n>> +++ b/builtin-remote.c\n>\n> For whatever reason, your patch does not apply (am) here on top of next\n> + Jim's patch. Given the context (xmallocs), it looks like it's against\n> something + Jim's patch. OTOH: 709f8a6 show's a get_one_entry with\n> mallocs. Did you hand edit the diff?\nIts on top of next (d6a466e528119011d512379f7f9dfac26deb7fd9), plus\nhand editing s/malloc/xmalloc/g.\nSorry for this.\n\nBert\n\n>\n> Michael\n>\n"},{"id":"116399","messageId":"4A3778B8.5040903@drmicha.warpmail.net","threadId":"19810","inReplyTo":"36ca99e90906160056w4f892dc7n761b7e7fb91a288d@mail.gmail.com","subject":"Re: [PATCH] builtin-remote: (get_one_entry): use strbuf","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-06-16T10:49:28Z","receivedAt":"2009-06-16T10:49:28Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Bert Wesarg venit, vidit, dixit 16.06.2009 09:56:\n> On Tue, Jun 16, 2009 at 09:39, Michael J Gruber<git@drmicha.warpmail.net> wrote:\n>> Bert Wesarg venit, vidit, dixit 15.06.2009 22:45:\n>>> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>>>\n>>> ---\n>>>\n>>> On Mon, Jun 15, 2009 at 09:49, Michael J Gruber<git@drmicha.warpmail.net> wrote:\n>>>> Jim Meyering venit, vidit, dixit 14.06.2009 21:46:\n>>>>>\n>>>>> * builtin-remote.c (get_one_entry): Use xmalloc, not malloc.\n>>>>\n>>>> Learning something new with every patch... Sorry, Junio; thanks, Jim!\n>>>>\n>>> One more reason to re-use existing string handling functions.\n>>\n>> Well, when we discussed this before v2 I asked for guidance about\n>> strbuf, esp. regarding the issue of allocating/freeing.\n> Well, I stopped reading after this question of yours: \"But what do\n> strbufs bring us here?\"\n\nWell, as I said I was strbuf-agnostic - some questions are really meant\nto be questions ;)\nIn any case, I've learned from your patch.\n\n> \n>> From your patch\n>> I infer that \"strbuf_detach\" is what I was looking for. (And yes, it is\n>> in the api doc where I overlooked it.)\n>>\n>>>  builtin-remote.c |   21 ++++++++++-----------\n>>>  1 files changed, 10 insertions(+), 11 deletions(-)\n>>>\n>>> diff --git a/builtin-remote.c b/builtin-remote.c\n>>> index 709f8a6..31adeaa 100644\n>>> --- a/builtin-remote.c\n>>> +++ b/builtin-remote.c\n>>\n>> For whatever reason, your patch does not apply (am) here on top of next\n>> + Jim's patch. Given the context (xmallocs), it looks like it's against\n>> something + Jim's patch. OTOH: 709f8a6 show's a get_one_entry with\n>> mallocs. Did you hand edit the diff?\n> Its on top of next (d6a466e528119011d512379f7f9dfac26deb7fd9), plus\n> hand editing s/malloc/xmalloc/g.\n> Sorry for this.\n> \n> Bert\n\nJunio will have to deal with it...\n\nMichael\n"},{"id":"116748","messageId":"1245659059-11852-1-git-send-email-bert.wesarg@googlemail.com","threadId":"19810","inReplyTo":"4A3778B8.5040903@drmicha.warpmail.net","subject":"[PATCH] builtin-remote: (get_one_entry): use strbuf","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2009-06-22T08:24:19Z","receivedAt":"2009-06-22T08:24:19Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n\n    On Tue, Jun 16, 2009 at 12:49, Michael J Gruber<git@drmicha.warpmail.net> wrote:\n    > Bert Wesarg venit, vidit, dixit 16.06.2009 09:56:\n    >> On Tue, Jun 16, 2009 at 09:39, Michael J Gruber<git@drmicha.warpmail.net> wrote:\n    >>> For whatever reason, your patch does not apply (am) here on top of next\n    >>> + Jim's patch. Given the context (xmallocs), it looks like it's against\n    >>> something + Jim's patch. OTOH: 709f8a6 show's a get_one_entry with\n    >>> mallocs. Did you hand edit the diff?\n    >> Its on top of next (d6a466e528119011d512379f7f9dfac26deb7fd9), plus\n    >> hand editing s/malloc/xmalloc/g.\n    >> Sorry for this.\n    >>\n    >> Bert\n    >\n    > Junio will have to deal with it...\n    Here is an updated version.\n\n    Bert\n\n builtin-remote.c |   21 ++++++++++-----------\n 1 files changed, 10 insertions(+), 11 deletions(-)\n\ndiff --git a/builtin-remote.c b/builtin-remote.c\nindex 658d578..d47a124 100644\n--- a/builtin-remote.c\n+++ b/builtin-remote.c\n@@ -1276,17 +1276,17 @@ static int update(int argc, const char **argv)\n static int get_one_entry(struct remote *remote, void *priv)\n {\n \tstruct string_list *list = priv;\n+\tstruct strbuf url_buf = STRBUF_INIT;\n+\tconst char *url_str = NULL;\n \tconst char **url;\n \tint i, url_nr;\n-\tvoid **utilp;\n \n \tif (remote->url_nr > 0) {\n-\t\tutilp = &(string_list_append(remote->name, list)->util);\n-\t\t*utilp = xmalloc(strlen(remote->url[0])+strlen(\" (fetch)\")+1);\n-\t\tstrcpy((char *) *utilp, remote->url[0]);\n-\t\tstrcat((char *) *utilp, \" (fetch)\");\n-\t} else\n-\t\tstring_list_append(remote->name, list)->util = NULL;\n+\t\tstrbuf_addf(&url_buf, \"%s (fetch)\", remote->url[0]);\n+\t\turl_str = strbuf_detach(&url_buf, NULL);\n+\t}\n+\tstring_list_append(remote->name, list)->util = url_str;\n+\n \tif (remote->pushurl_nr) {\n \t\turl = remote->pushurl;\n \t\turl_nr = remote->pushurl_nr;\n@@ -1296,10 +1296,9 @@ static int get_one_entry(struct remote *remote, void *priv)\n \t}\n \tfor (i = 0; i < url_nr; i++)\n \t{\n-\t\tutilp = &(string_list_append(remote->name, list)->util);\n-\t\t*utilp = xmalloc(strlen(url[i])+strlen(\" (push)\")+1);\n-\t\tstrcpy((char *) *utilp, url[i]);\n-\t\tstrcat((char *) *utilp, \" (push)\");\n+\t\tstrbuf_addf(&url_buf, \"%s (push)\", url[i]);\n+\t\turl_str = strbuf_detach(&url_buf, NULL);\n+\t\tstring_list_append(remote->name, list)->util = url_str;\n \t}\n \n \treturn 0;\n-- \ntg: (363bdbe..) bw/remote-v-use-strbuf (depends on: next)\n"},{"id":"116789","messageId":"20090622213204.GB19364@coredump.intra.peff.net","threadId":"19810","inReplyTo":"1245659059-11852-1-git-send-email-bert.wesarg@googlemail.com","subject":"Re: [PATCH] builtin-remote: (get_one_entry): use strbuf","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-06-22T21:32:04Z","receivedAt":"2009-06-22T21:32:04Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jun 22, 2009 at 10:24:19AM +0200, Bert Wesarg wrote:\n\n> --- a/builtin-remote.c\n> +++ b/builtin-remote.c\n> @@ -1276,17 +1276,17 @@ static int update(int argc, const char **argv)\n>  static int get_one_entry(struct remote *remote, void *priv)\n>  {\n>  \tstruct string_list *list = priv;\n> +\tstruct strbuf url_buf = STRBUF_INIT;\n> +\tconst char *url_str = NULL;\n>  \tconst char **url;\n>  \tint i, url_nr;\n> -\tvoid **utilp;\n>  \n>  \tif (remote->url_nr > 0) {\n> -\t\tutilp = &(string_list_append(remote->name, list)->util);\n> -\t\t*utilp = xmalloc(strlen(remote->url[0])+strlen(\" (fetch)\")+1);\n> -\t\tstrcpy((char *) *utilp, remote->url[0]);\n> -\t\tstrcat((char *) *utilp, \" (fetch)\");\n> -\t} else\n> -\t\tstring_list_append(remote->name, list)->util = NULL;\n> +\t\tstrbuf_addf(&url_buf, \"%s (fetch)\", remote->url[0]);\n> +\t\turl_str = strbuf_detach(&url_buf, NULL);\n> +\t}\n> +\tstring_list_append(remote->name, list)->util = url_str;\n> +\n\nThis causes const warnings due to the 'const' on url_str. One solution\nis just s/const char/char/.\n\nHowever, I think it is actually more readable to do away with url_str\nentirely. The original if/else logic was much easier to follow than\nrealizing that url_str is initialized to NULL, and then never changed.\nIOW:\n\n  if (remote->url_nr > 0) {\n          strbuf_addf(&url_buf, \"%s (fetch)\", remote->url[0]);\n          string_list_append(remote->name, list)->util =\n                  strbuf_detach(&url_buf, NULL);\n  }\n  else\n          string_list_append(remote->name, list)->util = NULL;\n\n> @@ -1296,10 +1296,9 @@ static int get_one_entry(struct remote *remote, void *priv)\n>  \t}\n>  \tfor (i = 0; i < url_nr; i++)\n>  \t{\n> -\t\tutilp = &(string_list_append(remote->name, list)->util);\n> -\t\t*utilp = xmalloc(strlen(url[i])+strlen(\" (push)\")+1);\n> -\t\tstrcpy((char *) *utilp, url[i]);\n> -\t\tstrcat((char *) *utilp, \" (push)\");\n> +\t\tstrbuf_addf(&url_buf, \"%s (push)\", url[i]);\n> +\t\turl_str = strbuf_detach(&url_buf, NULL);\n> +\t\tstring_list_append(remote->name, list)->util = url_str;\n>  \t}\n\nAnd then this one is re-using url_str for a totally unrelated thing,\nbut could just be:\n\n  string_list_append(remote->name, list)->util =\n          strbuf_detach(&url_buf, NULL);\n\nBut that is somewhat nit-picking. As long as the const-warning goes\naway, I will be happy enough.\n\n-Peff\n"},{"id":"116792","messageId":"1245709664-23611-1-git-send-email-bert.wesarg@googlemail.com","threadId":"19810","inReplyTo":"20090622213204.GB19364@coredump.intra.peff.net","subject":"[PATCH v2] builtin-remote: (get_one_entry): use strbuf","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2009-06-22T22:27:44Z","receivedAt":"2009-06-22T22:27:44Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\nv2: - remove assigment indirection\n    - keep old code flow\n\n  On Mon, Jun 22, 2009 at 23:32, Jeff King <peff@peff.net> wrote:\n  > But that is somewhat nit-picking. As long as the const-warning goes\n  > away, I will be happy enough.\n  >\n  Thanks for the review. I have no objections to your comments and have all\n  incroporated into v2.\n\n  Thanks,\n  Bert\n  > -Peff\n\n builtin-remote.c |   16 +++++++---------\n 1 files changed, 7 insertions(+), 9 deletions(-)\n\ndiff --git a/builtin-remote.c b/builtin-remote.c\nindex 658d578..2fb76d3 100644\n--- a/builtin-remote.c\n+++ b/builtin-remote.c\n@@ -1276,15 +1276,14 @@ static int update(int argc, const char **argv)\n static int get_one_entry(struct remote *remote, void *priv)\n {\n \tstruct string_list *list = priv;\n+\tstruct strbuf url_buf = STRBUF_INIT;\n \tconst char **url;\n \tint i, url_nr;\n-\tvoid **utilp;\n \n \tif (remote->url_nr > 0) {\n-\t\tutilp = &(string_list_append(remote->name, list)->util);\n-\t\t*utilp = xmalloc(strlen(remote->url[0])+strlen(\" (fetch)\")+1);\n-\t\tstrcpy((char *) *utilp, remote->url[0]);\n-\t\tstrcat((char *) *utilp, \" (fetch)\");\n+\t\tstrbuf_addf(&url_buf, \"%s (fetch)\", remote->url[0]);\n+\t\tstring_list_append(remote->name, list)->util =\n+\t\t\t\tstrbuf_detach(&url_buf, NULL);\n \t} else\n \t\tstring_list_append(remote->name, list)->util = NULL;\n \tif (remote->pushurl_nr) {\n@@ -1296,10 +1295,9 @@ static int get_one_entry(struct remote *remote, void *priv)\n \t}\n \tfor (i = 0; i < url_nr; i++)\n \t{\n-\t\tutilp = &(string_list_append(remote->name, list)->util);\n-\t\t*utilp = xmalloc(strlen(url[i])+strlen(\" (push)\")+1);\n-\t\tstrcpy((char *) *utilp, url[i]);\n-\t\tstrcat((char *) *utilp, \" (push)\");\n+\t\tstrbuf_addf(&url_buf, \"%s (push)\", url[i]);\n+\t\tstring_list_append(remote->name, list)->util =\n+\t\t\t\tstrbuf_detach(&url_buf, NULL);\n \t}\n \n \treturn 0;\n-- \ntg: (d4b46b0..) bw/remote-v-use-strbuf (depends on: next)\n"}]}