about summary refs log tree commit diff
path: root/lib/colorname.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/colorname.c')
-rw-r--r--lib/colorname.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/colorname.c b/lib/colorname.c
index cfaf026a..415cd0c3 100644
--- a/lib/colorname.c
+++ b/lib/colorname.c
@@ -195,7 +195,12 @@ pm_parse_dictionary_name(char    const colorname[],
     pixval r,g,b;
 
     f = pm_openColornameFile(NULL, TRUE);  /* exits if error */
-    canoncolor = strdup(colorname);
+    canoncolor = pm_strdup(colorname);
+
+    if (!canoncolor)
+        pm_error("Failed to allocate memory for %u-byte color name",
+                 (unsigned)strlen(colorname));
+
     pm_canonstr(canoncolor);
     gotit = FALSE;
     colorfileExhausted = FALSE;