com php-src: - Moved allocation to if block to make Coverity happy: ext/soap/php_sdl.c
| From: | Felipe Pena | Date: | Sun, 20 Oct 2013 02:36:28 +0000 |
| Subject: | com php-src: - Moved allocation to if block to make Coverity happy: ext/soap/php_sdl.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-73728@lists.php.net to get a copy of this message | ||
Commit: 85a622e42f815c3a62008eff21ec4ab259906e7e
Author: Felipe Pena <felipensp@gmail.com> Sat, 19 Oct 2013 23:36:28 -0300
Parents: aa4f9b322b18e3dffbe0646c802e6ed3cf71367e
Branches: PHP-5.4 PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=85a622e42f815c3a62008eff21ec4ab259906e7e
Log:
- Moved allocation to if block to make Coverity happy
Changed paths:
M ext/soap/php_sdl.c
Diff:
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
index 0ac4c2e..a7a5071 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);
}