media: gscpa/stv06xx: fix memory leak
[linux-2.6-microblaze.git] / drivers / media / usb / gspca / stv06xx / stv06xx.c
index 95673fc..d9bc2aa 100644 (file)
@@ -529,12 +529,21 @@ static int sd_int_pkt_scan(struct gspca_dev *gspca_dev,
 static int stv06xx_config(struct gspca_dev *gspca_dev,
                          const struct usb_device_id *id);
 
+static void stv06xx_probe_error(struct gspca_dev *gspca_dev)
+{
+       struct sd *sd = (struct sd *)gspca_dev;
+
+       kfree(sd->sensor_priv);
+       sd->sensor_priv = NULL;
+}
+
 /* sub-driver description */
 static const struct sd_desc sd_desc = {
        .name = MODULE_NAME,
        .config = stv06xx_config,
        .init = stv06xx_init,
        .init_controls = stv06xx_init_controls,
+       .probe_error = stv06xx_probe_error,
        .start = stv06xx_start,
        .stopN = stv06xx_stopN,
        .pkt_scan = stv06xx_pkt_scan,