[Nut-upsdev] Re: [nut-commits] svn commit r808 - in trunk: . drivers

Charles Lepple clepple at gmail.com
Fri Feb 16 06:46:30 CET 2007


I get the following error on r809 (but it looks like the code change
happened here). Does HIDDevice_t need to be defined/changed in one of
the headers?

if gcc -DHAVE_CONFIG_H -I. -I../../drivers -I../include
-I../../include -DDBUS_API_SUBJECT_TO_CHANGE -I/usr/include/hal
-I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include    -DINET6 -O2
-D_REENTRANT -DNETSNMP_USE_INLINE -Wall -Dlinux -I. -I/usr/include -O
-Wall -Wsign-compare -MT libusb.o -MD -MP -MF ".deps/libusb.Tpo" -c -o
libusb.o ../../drivers/libusb.c; \
	then mv -f ".deps/libusb.Tpo" ".deps/libusb.Po"; else rm -f
".deps/libusb.Tpo"; exit 1; fi
../../drivers/libusb.c:93: error: expected declaration specifiers or
'...' before 'HIDDevice_t'
../../drivers/libusb.c: In function 'libusb_open':
../../drivers/libusb.c:138: error: 'curDevice' undeclared (first use
in this function)
../../drivers/libusb.c:138: error: (Each undeclared identifier is
reported only once
../../drivers/libusb.c:138: error: for each function it appears in.)
../../drivers/libusb.c: At top level:
../../drivers/libusb.c:415: warning: initialization from incompatible
pointer type
make[4]: *** [libusb.o] Error 1

On 2/15/07, Peter Selinger <selinger-guest at alioth.debian.org> wrote:
> Author: selinger-guest
> Date: Thu Feb 15 22:37:04 2007
> New Revision: 808
>
> Modified:
>    trunk/ChangeLog
>    trunk/drivers/libusb.c
> Log:
>  - libusb.c: fixed small memory leak, reported by Jacob Schmier.
>
>
> Modified: trunk/ChangeLog
> ==============================================================================
> --- trunk/ChangeLog     (original)
> +++ trunk/ChangeLog     Thu Feb 15 22:37:04 2007
> @@ -1,3 +1,7 @@
> +Thu Feb 15 21:30:13 UTC 2007 / Peter Selinger <selinger at users.sourceforge.net>
> +
> + - libusb.c: fixed small memory leak, reported by Jacob Schmier.
> +
>  Mon Feb  5 05:30:24 UTC 2007 / Peter Selinger <selinger at users.sourceforge.net>
>
>   - libshut.c: fixed uninitialized variable
>
> Modified: trunk/drivers/libusb.c
> ==============================================================================
> --- trunk/drivers/libusb.c      (original)
> +++ trunk/drivers/libusb.c      Thu Feb 15 22:37:04 2007
> @@ -87,8 +87,10 @@
>      failure, return -1. Note: ReportDesc must point to a large enough
>      buffer. There's no way to know the size ahead of time. Matcher is
>      a linked list of matchers (see libhid.h), and the opened device
> -    must match all of them. */
> -static int libusb_open(usb_dev_handle **udevp, HIDDevice *curDevice, HIDDeviceMatcher_t *matcher, unsigned char *ReportDesc, int mode)
> +    must match all of them. Also note: the string components of
> +    curDevice are filled with allocated strings that must later be
> +    freed. */
> +static int libusb_open(usb_dev_handle **udevp, HIDDevice_t *curDevice, HIDDeviceMatcher_t *matcher, unsigned char *ReportDesc, int mode)
>  {
>         int found = 0;
>  #if LIBUSB_HAS_DETACH_KRNL_DRV
> @@ -138,7 +140,7 @@
>                         curDevice->Vendor = NULL;
>                         curDevice->Product = NULL;
>                         curDevice->Serial = NULL;
> -                       curDevice->Bus = bus->dirname;
> +                       curDevice->Bus = strdup(bus->dirname);
>
>                         if (dev->descriptor.iManufacturer) {
>                                 ret = usb_get_string_simple(udev, dev->descriptor.iManufacturer, string, sizeof(string));
> @@ -307,6 +309,10 @@
>                         return rdlen;
>
>                 next_device:
> +                       free(curDevice->Vendor);
> +                       free(curDevice->Product);
> +                       free(curDevice->Serial);
> +                       free(curDevice->Bus);
>                         usb_close(udev);
>                         udev = NULL;
>                 }
>
> _______________________________________________
> nut-commits mailing list
> nut-commits at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/nut-commits
>


-- 
- Charles Lepple



More information about the Nut-upsdev mailing list