shithub: aacenc

Download patch

ref: d2cdbaf885cfe2efabe0b4c1a6011bb3fb5b2781
parent: fdff41e7018a893b62e37214199e58972228650c
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sun Nov 27 16:05:02 EST 2022

aacenc: check for errors Bflush returns

--- a/frontend/aacenc.c
+++ b/frontend/aacenc.c
@@ -152,14 +152,11 @@
 			for(i = 0; i < 8; i++, ns >>= 8)
 				ph[12+i] = ns;
 			ns = 0;
-			if(Bwrite(&out, ph, sizeof(ph)) < 0)
+			if(Bwrite(&out, ph, sizeof(ph)) < 0 || Bflush(&out) < 0)
 				break;
-			Bflush(&out);
 		}
-		if(Bwrite(&out, obuf, sz) < 0)
+		if(Bwrite(&out, obuf, sz) < 0 || (nobuffer && Bflush(&out) < 0))
 			break;
-		if(nobuffer)
-			Bflush(&out);
 	}
 	Bflush(&out);