r16322: Klocwork #481., Don't deref null on malloc fail.
authorJeremy Allison <jra@samba.org>
Fri, 16 Jun 2006 23:14:12 +0000 (23:14 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:17:33 +0000 (11:17 -0500)
Jeremy.

source/libads/ldap.c

index 7fb5dac51bbee4d3b51e139eb2f28bd3e7458bd9..be15643ba2f01ec8952bac1de55b283b73377c48 100644 (file)
@@ -1956,8 +1956,10 @@ char **ads_pull_strings_range(ADS_STRUCT *ads,
                return NULL;
        }
        
-       memcpy(&strings[*num_strings], new_strings,
-              sizeof(*new_strings) * num_new_strings);
+       if (new_strings && num_new_strings) {
+               memcpy(&strings[*num_strings], new_strings,
+                      sizeof(*new_strings) * num_new_strings);
+       }
 
        (*num_strings) += num_new_strings;