[PECL-CVS] [pecl-web_services-oauth] memory-safety-audit: address reviews

[email protected] (Rasmus Lerdorf) Sun, 5 Apr 2026 02:31:01 +0000
Newsgroups php.pecl.cvs
Message-ID <[email protected]>
Author: Rasmus Lerdorf (rlerdorf)
Date: 2026-04-04T22:30:56-04:00

Commit: https://github.com/php/pecl-web_services-oauth/commit/f3a7ef0f1583220e47547a0f079a043f27eaf02b
Raw diff: https://github.com/php/pecl-web_services-oauth/commit/f3a7ef0f1583220e47547a0f079a043f27eaf02b.diff

address reviews

Changed paths:
  M  provider.c


Diff:

diff --git a/provider.c b/provider.c
index 1095791..295af02 100644
--- a/provider.c
+++ b/provider.c
@@ -197,9 +197,9 @@ static inline int oauth_provider_set_param_value(HashTable *ht, char *key, zval
 	Z_TRY_ADDREF_P(val);
 	if (zend_hash_str_update(ht, key, strlen(key), val) == NULL) {
 		Z_TRY_DELREF_P(val);
-		return 0;
+		return FAILURE;
 	}
-	return 1;
+	return SUCCESS;
 }
 /* }}} */
 
@@ -290,7 +290,7 @@ static int oauth_provider_parse_auth_header(php_oauth_provider *sop, char *auth_
 			ZVAL_STRINGL(&decoded_val, tmp, decoded_len);
 			efree(tmp);
 
-			if (!oauth_provider_set_param_value(sop->oauth_params, Z_STRVAL_P(current_param), &decoded_val)) {
+			if (oauth_provider_set_param_value(sop->oauth_params, Z_STRVAL_P(current_param), &decoded_val) == FAILURE) {
 				zval_ptr_dtor(&decoded_val);
 				zval_ptr_dtor(&return_value);
 				zval_ptr_dtor(&subpats);
@@ -609,7 +609,7 @@ SOP_METHOD(__construct)
 		do {
 			if(zend_hash_get_current_key_ex(Z_ARRVAL_P(params), &key, &num_key, &hpos) == HASH_KEY_IS_STRING) {
 				if((item_param = zend_hash_get_current_data_ex(Z_ARRVAL_P(params), &hpos)) != NULL) {
-					if(!oauth_provider_set_param_value(sop->oauth_params, ZSTR_VAL(key), item_param)) {
+					if(oauth_provider_set_param_value(sop->oauth_params, ZSTR_VAL(key), item_param) == FAILURE) {
 						return;
 					}
 				}