]> granicus.if.org Git - graphviz/commitdiff
fix coverity #82930
authorJohn Ellson <ellson@research.att.com>
Tue, 6 Jan 2015 15:57:53 +0000 (10:57 -0500)
committerJohn Ellson <ellson@research.att.com>
Tue, 6 Jan 2015 15:57:53 +0000 (10:57 -0500)
lib/gvc/gvusershape.c

index 7869a26a219e01733a989ef06028740dbb04cb2e..3e6b1825470bb9f36fd093ca6ccd6f5cc562af6e 100644 (file)
@@ -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);