Changeset: e465285a6a7a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e465285a6a7a
Modified Files:
monetdb5/modules/atoms/str.c
Branch: txtsim
Log Message:
Don't free if not alloc. Only free the first string if the second fails.
diffs (63 lines):
diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c
--- a/monetdb5/modules/atoms/str.c
+++ b/monetdb5/modules/atoms/str.c
@@ -3638,13 +3638,10 @@ STRstartsWith(Client cntxt, MalBlkPtr mb
str s = *arg1, prefix = *arg2, msg = MAL_SUCCEED;
if (icase) {
- if ((msg = STRlower(&s, &s)) != MAL_SUCCEED) {
- GDKfree(s);
+ if ((msg = STRlower(&s, &s)) != MAL_SUCCEED)
goto bail;
- }
if ((msg = STRlower(&prefix, &prefix)) != MAL_SUCCEED) {
GDKfree(s);
- GDKfree(prefix);
goto bail;
}
}
@@ -3676,13 +3673,10 @@ STRendsWith(Client cntxt, MalBlkPtr mb,
str s = *arg1, suffix = *arg2, msg = MAL_SUCCEED;
if (icase) {
- if ((msg = STRlower(&s, &s)) != MAL_SUCCEED) {
- GDKfree(s);
+ if ((msg = STRlower(&s, &s)) != MAL_SUCCEED)
goto bail;
- }
if ((msg = STRlower(&suffix, &suffix)) != MAL_SUCCEED) {
GDKfree(s);
- GDKfree(suffix);
goto bail;
}
}
@@ -3713,13 +3707,10 @@ STRstr_search(Client cntxt, MalBlkPtr mb
str s = *haystack, h = *needle, msg = MAL_SUCCEED;
if (icase) {
- if ((msg = STRlower(&s, &s)) != MAL_SUCCEED) {
- GDKfree(s);
+ if ((msg = STRlower(&s, &s)) != MAL_SUCCEED)
goto bail;
- }
if ((msg = STRlower(&h, &h)) != MAL_SUCCEED) {
GDKfree(s);
- GDKfree(h);
goto bail;
}
}
@@ -3760,13 +3751,10 @@ STRrevstr_search(Client cntxt, MalBlkPtr
str s = *haystack, h = *needle, msg = MAL_SUCCEED;
if (icase) {
- if ((msg = STRlower(&s, &s)) != MAL_SUCCEED) {
- GDKfree(s);
+ if ((msg = STRlower(&s, &s)) != MAL_SUCCEED)
goto bail;
- }
if ((msg = STRlower(&h, &h)) != MAL_SUCCEED) {
GDKfree(s);
- GDKfree(h);
goto bail;
}
}
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]