Skip to content

Commit 85a622e

Browse files
committed
- Moved allocation to if block to make Coverity happy
1 parent aa4f9b3 commit 85a622e

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

ext/soap/php_sdl.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2644,16 +2644,17 @@ static sdlAttributePtr make_persistent_sdl_attribute(sdlAttributePtr attr, HashT
26442644

26452645
zend_hash_internal_pointer_reset(pattr->extraAttributes);
26462646
while (zend_hash_get_current_data(attr->extraAttributes, (void**)&tmp) == SUCCESS) {
2647-
pextra = malloc(sizeof(sdlExtraAttribute));
2648-
memset(pextra, 0, sizeof(sdlExtraAttribute));
2649-
if ((*tmp)->ns) {
2650-
pextra->ns = strdup((*tmp)->ns);
2651-
}
2652-
if ((*tmp)->val) {
2653-
pextra->val = strdup((*tmp)->val);
2654-
}
2647+
if (zend_hash_get_current_key_ex(attr->extraAttributes, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) {
2648+
pextra = malloc(sizeof(sdlExtraAttribute));
2649+
memset(pextra, 0, sizeof(sdlExtraAttribute));
26552650

2656-
if (zend_hash_get_current_key_ex(attr->extraAttributes, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) {
2651+
if ((*tmp)->ns) {
2652+
pextra->ns = strdup((*tmp)->ns);
2653+
}
2654+
if ((*tmp)->val) {
2655+
pextra->val = strdup((*tmp)->val);
2656+
}
2657+
26572658
zend_hash_add(pattr->extraAttributes, key, key_len, (void*)&pextra, sizeof(sdlExtraAttributePtr), NULL);
26582659
}
26592660

0 commit comments

Comments
 (0)