summaryrefslogtreecommitdiff
path: root/ext/soap/php_sdl.c
diff options
context:
space:
mode:
authorFelipe Pena <felipensp@gmail.com>2013-10-19 23:36:28 -0300
committerFelipe Pena <felipensp@gmail.com>2013-10-19 23:36:28 -0300
commit85a622e42f815c3a62008eff21ec4ab259906e7e (patch)
tree6342b9a6305d5caac3a09c14761366de6d4730f2 /ext/soap/php_sdl.c
parentaa4f9b322b18e3dffbe0646c802e6ed3cf71367e (diff)
downloadphp-git-85a622e42f815c3a62008eff21ec4ab259906e7e.tar.gz
- Moved allocation to if block to make Coverity happy
Diffstat (limited to 'ext/soap/php_sdl.c')
-rw-r--r--ext/soap/php_sdl.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
index 0ac4c2ed7a..a7a5071c08 100644
--- a/ext/soap/php_sdl.c
+++ b/ext/soap/php_sdl.c
@@ -2644,16 +2644,17 @@ static sdlAttributePtr make_persistent_sdl_attribute(sdlAttributePtr attr, HashT
zend_hash_internal_pointer_reset(pattr->extraAttributes);
while (zend_hash_get_current_data(attr->extraAttributes, (void**)&tmp) == SUCCESS) {
- pextra = malloc(sizeof(sdlExtraAttribute));
- memset(pextra, 0, sizeof(sdlExtraAttribute));
- if ((*tmp)->ns) {
- pextra->ns = strdup((*tmp)->ns);
- }
- if ((*tmp)->val) {
- pextra->val = strdup((*tmp)->val);
- }
+ if (zend_hash_get_current_key_ex(attr->extraAttributes, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) {
+ pextra = malloc(sizeof(sdlExtraAttribute));
+ memset(pextra, 0, sizeof(sdlExtraAttribute));
- if (zend_hash_get_current_key_ex(attr->extraAttributes, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) {
+ if ((*tmp)->ns) {
+ pextra->ns = strdup((*tmp)->ns);
+ }
+ if ((*tmp)->val) {
+ pextra->val = strdup((*tmp)->val);
+ }
+
zend_hash_add(pattr->extraAttributes, key, key_len, (void*)&pextra, sizeof(sdlExtraAttributePtr), NULL);
}