[Nut-upsdev] newhidups with APC Smart-UPS 1500
Peter Selinger
selinger at mathstat.dal.ca
Thu Oct 19 00:12:14 UTC 2006
Hi Jacob,
drats, that was a dumb mistake. Thanks for catching this. Your patch
does not quite fix the problem; the real problem is that I freed the
data structure when it sometimes hadn't been created. I just committed
a bugfix that hopefully fixes it (see below patch).
-- Peter
Schmier, Jacob wrote:
>
> Peter,
>
> When I test your fix (newhidups -DDD /dev/null) using a MGE Pulsar
> Evolution 2200, I get a segmentation fault. I do not get this problem
> when running the 2.0.4 release. There seems to be a 3-5 second delay
> between the "Waiting for notifications..." output and the segmentation
> fault.
>
> By initializing the eventlist pointer to NULL in upsdrv_updateinfo, I
> was able to correct the problem. So I believe the fix would be the
> following:
>
> -HIDEvent *eventlist;
> +HIDEvent *eventlist = NULL;
>
>
> ~Jacob
Index: drivers/newhidups.c
===================================================================
--- drivers/newhidups.c (revision 551)
+++ drivers/newhidups.c (working copy)
@@ -558,9 +558,10 @@
for (p=eventlist; p!=NULL; p=p->next)
{
/* Check if we are asked to stop (reactivity++) */
- if (exit_flag != 0)
+ if (exit_flag != 0) {
+ HIDFreeEvents(eventlist);
return;
-
+ }
upsdebugx(3, "Object: %s = %ld",
p->Path,
p->Value);
@@ -602,11 +603,11 @@
}
}
dstate_dataok();
+ HIDFreeEvents(eventlist);
}
else {
retcode = evtCount; /* propagate error code */
}
- HIDFreeEvents(eventlist);
/* Quick poll on main ups.status data */
hid_ups_walk(HU_WALKMODE_QUICK_UPDATE);
More information about the Nut-upsdev
mailing list