1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

optget: Improve memory leak fix (re: 333a8ca6)

The memory leak only occurred when an \f...\f string was used
outside a braces block ('{'...'}' a.k.a. GO...OG). This shows
the way to a more correct and elegant fix.

Co-authored by: Martijn Dekker <martijn@inlv.org>
This commit is contained in:
atheik 2022-04-21 22:47:30 +02:00 committed by Martijn Dekker
parent b52edb380c
commit 29010761a5

View file

@ -2140,7 +2140,7 @@ textout(Sfio_t* sp, register char* s, char* conform, int conformlen, int style,
} }
} }
} }
else if (!*s) else if (*s != OG)
{ {
if (!(tsp = psp)) if (!(tsp = psp))
break; break;
@ -2148,8 +2148,6 @@ textout(Sfio_t* sp, register char* s, char* conform, int conformlen, int style,
psp = psp->next; psp = psp->next;
free(tsp); free(tsp);
} }
else if (*s != OG)
break;
else else
{ {
s++; s++;
@ -2157,7 +2155,6 @@ textout(Sfio_t* sp, register char* s, char* conform, int conformlen, int style,
break; break;
} }
} }
pop(psp);
return s; return s;
} }
s++; s++;