--On Monday, July 22, 2002 1:34 PM +0300 Kaido Karner <[EMAIL PROTECTED]>
wrote:
> re
>
> emi2 smsc connections by mistake increase received messages counter twice.
>
> patch is together with the previous fix in smsc_emi2.c
>
>
> diff -u gateway-1.2.0/gw/smsc_emi2.c gateway-patched/gw/smsc_emi2.c
> --- gateway-1.2.0/gw/smsc_emi2.c Fri Jun 28 14:09:54 2002
> +++ gateway-patched/gw/smsc_emi2.c Mon Jul 22 13:29:15 2002
[snip]
> @@ -1606,8 +1605,6 @@
> privdata->deny_ip = deny_ip;
>
> if (privdata->rport > 0 && emi2_open_listening_socket(privdata) < 0)
> { - gw_free(privdata);
> - privdata = NULL;
I think I would prefer to have these combined into a single function.
gw_free now maps onto the gw_native_free or gw_check_free with macros.
We could make the macros as such that they pass the pointer to the
address space containing the pointer and make the pointer even NULL.
Then the define
#define gw_free(ptr) (gw_native_free(ptr))
would be become
#define gw_free(ptr) (gw_native_free(&ptr))
and then
void gw_native_free(void *ptr);
would be become
void gw_native_free(void **ptr);
What do others think?? I guess that in more places the pointer needs
to be 'NULL'-ed after the free.
Harrie
Internet Management Consulting
mailto: [EMAIL PROTECTED] http://www.lisanza.net/
--------------------------------------------------------------------
Author of MOD-SNMP, enabling SNMP management the Apache HTTP server