From: John Ellson Date: Tue, 6 Jan 2015 15:57:53 +0000 (-0500) Subject: fix coverity #82930 X-Git-Tag: TRAVIS_CI_BUILD_EXPERIMENTAL~129^2~6^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=78276670b3c4a85ad2bf6ad480cef1cd1a03b28b;p=graphviz fix coverity #82930 --- diff --git a/lib/gvc/gvusershape.c b/lib/gvc/gvusershape.c index 7869a26a2..3e6b18254 100644 --- a/lib/gvc/gvusershape.c +++ b/lib/gvc/gvusershape.c @@ -570,7 +570,7 @@ static Dtdisc_t ImageDictDisc = { NIL(Dtevent_f) }; -usershape_t *gvusershape_find(char *name) +usershape_t *gvusershape_find(const char *name) { usershape_t *us; @@ -629,7 +629,7 @@ void gvusershape_file_release(usershape_t *us) } } -static usershape_t *gvusershape_open (char *name) +static usershape_t *gvusershape_open (const char *name) { usershape_t *us; @@ -642,9 +642,11 @@ static usershape_t *gvusershape_open (char *name) if (! (us = zmalloc(sizeof(usershape_t)))) return NULL; - us->name = agstrdup (0, name); - if (!gvusershape_file_access(us)) + us->name = name; + if (!gvusershape_file_access(us)) { + free(us); return NULL; + } assert(us->f);