addons/51degrees/51d.c:130:3: warning: If memory allocation fails, then there 
is a possible null pointer dereference: name [nullPointerOutOfMemory]
---
 addons/51degrees/51d.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/addons/51degrees/51d.c b/addons/51degrees/51d.c
index 5b3db1286..357aabc12 100644
--- a/addons/51degrees/51d.c
+++ b/addons/51degrees/51d.c
@@ -127,7 +127,16 @@ static int _51d_property_name_list(char **args, int 
section_type, struct proxy *
 
        while (*(args[cur_arg])) {
                name = calloc(1, sizeof(*name));
+               if (!name) {
+                       memprintf(err, "'%s' failed to allocate memory.", 
args[0]);
+                       return -1;
+               }
                name->name = strdup(args[cur_arg]);
+               if (!name->name) {
+                       free(name);
+                       memprintf(err, "'%s' failed to allocate memory.", 
args[0]);
+                       return -1;
+               }
                LIST_APPEND(&global_51degrees.property_names, &name->list);
                ++cur_arg;
        }
-- 
2.46.0.windows.1



Reply via email to