]> granicus.if.org Git - curl/commitdiff
getparam: fix the GetStr() macro
authorDaniel Stenberg <daniel@haxx.se>
Fri, 13 Jul 2012 21:39:25 +0000 (23:39 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 15 Jul 2012 18:33:11 +0000 (20:33 +0200)
It should return PARAM_NO_MEM if the strdup fails. Spotted by
clang-analyzer

src/tool_getparam.c

index 579437eb778e1cab3ff7e9e130ccc2293f989202..685c224de3b9a04f9be0ab4bd3dee148812417b9 100644 (file)
     free(*(str)); \
     *(str) = NULL; \
   } \
-  if((val)) \
+  if((val)) {              \
     *(str) = strdup((val)); \
-  if(!(val)) \
-    return PARAM_NO_MEM; \
+    if(!(*(str)))          \
+      return PARAM_NO_MEM; \
+  } \
 } WHILE_FALSE
 
 struct LongShort {