properly release private pointer, add check for fd
This commit is contained in:
@@ -513,12 +513,9 @@ int CwLnx_init(Driver * drvthis)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Initialise the PrivateData structure */
|
/* Initialise the PrivateData structure */
|
||||||
|
p->fd = -1;
|
||||||
p->framebuf = NULL;
|
p->framebuf = NULL;
|
||||||
p->backingstore = NULL;
|
p->backingstore = NULL;
|
||||||
|
|
||||||
/* height and width are computed from DEFAULT_SIZE */
|
|
||||||
/* p->width = DEFAULT_WIDTH; */
|
|
||||||
/* p->height = DEFAULT_HEIGHT; */
|
|
||||||
p->cellwidth = DEFAULT_CELLWIDTH;
|
p->cellwidth = DEFAULT_CELLWIDTH;
|
||||||
p->cellheight = DEFAULT_CELLHEIGHT;
|
p->cellheight = DEFAULT_CELLHEIGHT;
|
||||||
|
|
||||||
@@ -679,18 +676,19 @@ CwLnx_close(Driver *drvthis)
|
|||||||
PrivateData * p = drvthis->private_data;
|
PrivateData * p = drvthis->private_data;
|
||||||
|
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
|
if (p->fd >= 0)
|
||||||
close(p->fd);
|
close(p->fd);
|
||||||
|
|
||||||
if (p->framebuf != NULL)
|
if (p->framebuf != NULL)
|
||||||
free(p->framebuf);
|
free(p->framebuf);
|
||||||
p->framebuf = NULL;
|
|
||||||
|
|
||||||
if (p->backingstore != NULL)
|
if (p->backingstore != NULL)
|
||||||
free(p->backingstore);
|
free(p->backingstore);
|
||||||
p->backingstore = NULL;
|
|
||||||
|
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
drvthis->store_private_ptr(drvthis, NULL);
|
||||||
|
|
||||||
debug(RPT_DEBUG, "CwLnx: closed");
|
debug(RPT_DEBUG, "CwLnx: closed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user