diff regexp/regexp.c @ 55:68263b10998e

Updated: added bat_iterator_end.
author Sjoerd Mullender <sjoerd@acm.org>
date Wed, 26 Jan 2022 14:59:05 +0100 (2022-01-26)
parents da896864dbbd
children 8122094c79b1
line wrap: on
line diff
--- a/regexp/regexp.c	Mon Dec 13 12:40:58 2021 +0100
+++ b/regexp/regexp.c	Wed Jan 26 14:59:05 2022 +0100
@@ -197,6 +197,7 @@
 			pos = pcre_exec(re, sd, val, (int) strlen(val), 0, 0, NULL, 0);
 			if (pos < 0 && pos != PCRE_ERROR_NOMATCH && pos != PCRE_ERROR_BADUTF8) {
 				/* error during processing */
+				bat_iterator_end(&bi);
 				BBPunfix(b->batCacheid);
 				BBPreclaim(bn);
 				pcre_free_study(sd);
@@ -208,6 +209,7 @@
 			*outp++ = pos >= 0; /* TRUE if match, FALSE if not */
 		}
 	}
+	bat_iterator_end(&bi);
 
 	/* set properties and size of result BAT */
 	BATsetcount(bn, BATcount(b));
@@ -381,6 +383,7 @@
 					*outp++ = o;
 			} else {
 				/* error during processing */
+				bat_iterator_end(&bi);
 				BBPunfix(b->batCacheid);
 				BBPunfix(s->batCacheid);
 				BBPreclaim(bn);
@@ -392,6 +395,8 @@
 			}
 		}
 	}
+	/* we're done with the BAT iterator */
+	bat_iterator_end(&bi);
 	/* we're done with b, s, and re */
 	BBPunfix(b->batCacheid);
 	if (s)
@@ -610,6 +615,8 @@
 		pcre_free_study(sd);
 		pcre_free(re);
 	}
+	bat_iterator_end(&li);
+	bat_iterator_end(&ri);
 
 	BBPunfix(l->batCacheid);
 	BBPunfix(r->batCacheid);
@@ -624,6 +631,8 @@
 	return MAL_SUCCEED;
 
   bailout:
+	bat_iterator_end(&li);
+	bat_iterator_end(&ri);
 	BBPreclaim(bn1);
 	BBPreclaim(bn2);
 	BBPunfix(l->batCacheid);