diff mbox

Question about libv4lconvert.

Message ID 20101215171139.b6c1f03a.ospite@studenti.unina.it (mailing list archive)
State RFC
Headers show

Commit Message

Antonio Ospite Dec. 15, 2010, 4:11 p.m. UTC
None
diff mbox

Patch

diff --git a/lib/libv4lconvert/libv4lconvert.c b/lib/libv4lconvert/libv4lconvert.c
index 26a0978..46e6500 100644
--- a/lib/libv4lconvert/libv4lconvert.c
+++ b/lib/libv4lconvert/libv4lconvert.c
@@ -854,7 +854,7 @@  static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data,
 		if (src_size < (width * height)) {
 			V4LCONVERT_ERR("short grey data frame\n");
 			errno = EPIPE;
-			result = -1;
+			return -1;
 		}
 		break;
 	case V4L2_PIX_FMT_RGB565:

And:

diff --git a/lib/libv4lconvert/libv4lconvert.c b/lib/libv4lconvert/libv4lconvert.c
index 46e6500..a1a4858 100644
--- a/lib/libv4lconvert/libv4lconvert.c
+++ b/lib/libv4lconvert/libv4lconvert.c
@@ -841,6 +841,11 @@  static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data,
 		break;
 
 	case V4L2_PIX_FMT_GREY:
+		if (src_size < (width * height)) {
+			V4LCONVERT_ERR("short grey data frame\n");
+			errno = EPIPE;
+			return -1;
+		}
 		switch (dest_pix_fmt) {
 		case V4L2_PIX_FMT_RGB24:
 	        case V4L2_PIX_FMT_BGR24:
@@ -851,11 +856,6 @@  static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data,
 			v4lconvert_grey_to_yuv420(src, dest, fmt);
 			break;
 		}
-		if (src_size < (width * height)) {
-			V4LCONVERT_ERR("short grey data frame\n");
-			errno = EPIPE;
-			return -1;
-		}
 		break;
 	case V4L2_PIX_FMT_RGB565:
 		switch (dest_pix_fmt) {