[PECL-CVS] [pecl-file_formats-yaml] fix-memory-leaks: get rid of the goto

[email protected] (Rasmus Lerdorf) Sun, 5 Apr 2026 03:30:20 +0000
Newsgroups php.pecl.cvs
Message-ID <[email protected]>
Author: Rasmus Lerdorf (rlerdorf)
Date: 2026-04-04T23:30:12-04:00

Commit: https://github.com/php/pecl-file_formats-yaml/commit/4de93546095a2691416b51254d399df7d8defbe3
Raw diff: https://github.com/php/pecl-file_formats-yaml/commit/4de93546095a2691416b51254d399df7d8defbe3.diff

get rid of the goto

Changed paths:
  M  emit.c


Diff:

diff --git a/emit.c b/emit.c
index 50407a7..69b7f30 100644
--- a/emit.c
+++ b/emit.c
@@ -580,18 +580,17 @@ static int y_write_array(
 			/* emit key */
 			status = y_write_zval(state, &key_zval, NULL);
 			if (SUCCESS != status) {
-				goto cleanup_ht;
+				break;
 			}
 		}
 
 		status = y_write_zval(state, elm, NULL);
 
 		if (SUCCESS != status) {
-			goto cleanup_ht;
+			break;
 		}
 	} ZEND_HASH_FOREACH_END();
 
-cleanup_ht:
 #if PHP_VERSION_ID >= 70300
 	if (!(GC_FLAGS(ht) & GC_IMMUTABLE)) {
 		GC_UNPROTECT_RECURSION(ht);