Module Name:    src
Committed By:   mlelstv
Date:           Sun May 16 09:17:23 UTC 2021

Modified Files:
        src/sys/dev/usb: uvideo.c

Log Message:
close pipe before freeing frame length array.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/dev/usb/uvideo.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/uvideo.c
diff -u src/sys/dev/usb/uvideo.c:1.59 src/sys/dev/usb/uvideo.c:1.60
--- src/sys/dev/usb/uvideo.c:1.59	Mon Aug 10 19:27:27 2020
+++ src/sys/dev/usb/uvideo.c	Sun May 16 09:17:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvideo.c,v 1.59 2020/08/10 19:27:27 rjs Exp $	*/
+/*	$NetBSD: uvideo.c,v 1.60 2021/05/16 09:17:23 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 2008 Patrick Mahoney
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.59 2020/08/10 19:27:27 rjs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.60 2021/05/16 09:17:23 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1659,7 +1659,15 @@ uvideo_stream_stop_xfer(struct uvideo_st
 				usbd_destroy_xfer(isoc->i_xfer);
 				isoc->i_xfer = NULL;
 			}
+		}
+
+		if (ix->ix_pipe != NULL) {
+			usbd_close_pipe(ix->ix_pipe);
+			ix->ix_pipe = NULL;
+		}
 
+		for (i = 0; i < UVIDEO_NXFERS; i++) {
+			struct uvideo_isoc *isoc = &ix->ix_i[i];
 			if (isoc->i_frlengths != NULL) {
 				kmem_free(isoc->i_frlengths,
 				  sizeof(isoc->i_frlengths[0]) *
@@ -1668,10 +1676,6 @@ uvideo_stream_stop_xfer(struct uvideo_st
 			}
 		}
 
-		if (ix->ix_pipe != NULL) {
-			usbd_close_pipe(ix->ix_pipe);
-			ix->ix_pipe = NULL;
-		}
 		/* Give it some time to settle */
 		usbd_delay_ms(vs->vs_parent->sc_udev, 1000);
 

Reply via email to