diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-10-08 12:32:49 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-10-08 12:32:49 +0200 |
commit | cfd27ef2ad8b005fd47ab41ef29b71d9e3d48201 (patch) | |
tree | 56cb8849a5df91b19b72fd4f48c79c343cd9bc5e /backend/ricoh.c | |
parent | ba8d09abe681600aad991f4a75e904615b7ed29f (diff) |
Imported Upstream version 1.0.25upstream/1.0.25
Diffstat (limited to 'backend/ricoh.c')
-rw-r--r-- | backend/ricoh.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/backend/ricoh.c b/backend/ricoh.c index a349179..88f33d1 100644 --- a/backend/ricoh.c +++ b/backend/ricoh.c @@ -73,6 +73,7 @@ #define MAX(a,b) ((a) > (b) ? (a) : (b)) +static const SANE_Device **devlist = NULL; static int num_devices = 0; static Ricoh_Device *first_dev = NULL; static Ricoh_Scanner *first_handle = NULL; @@ -221,11 +222,13 @@ attach (const char *devnam, Ricoh_Device ** devp) dev->sane.name = strdup (devnam); dev->sane.vendor = "RICOH"; - str = malloc (16 + 1); - memset (str, 0, sizeof (str)); - strncpy (str, (char *)ibuf.product, sizeof(ibuf.product)); - strncpy (str + sizeof(ibuf.revision), (char *)ibuf.revision, sizeof(ibuf.revision)); - str[sizeof(ibuf.product) + sizeof(ibuf.revision)] = '\0'; + str = malloc (sizeof(ibuf.product) + sizeof(ibuf.revision) + 1); + if (str) + { + str[0] = '\0'; + strncat (str, (char *)ibuf.product, sizeof(ibuf.product)); + strncat (str, (char *)ibuf.revision, sizeof(ibuf.revision)); + } dev->sane.model = str; dev->sane.type = "flatbed scanner"; @@ -535,6 +538,9 @@ sane_exit (void) free ((void *) dev->sane.model); free (dev); } + + if (devlist) + free (devlist); DBG (11, "<< sane_exit\n"); } @@ -542,7 +548,6 @@ sane_exit (void) SANE_Status sane_get_devices (const SANE_Device *** device_list, SANE_Bool local_only) { - static const SANE_Device **devlist = 0; Ricoh_Device *dev; int i; |