Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2004:
[Freeciv-Dev] Re: (PR#8500) packet_single_want_hack_req isn't freed
Home

[Freeciv-Dev] Re: (PR#8500) packet_single_want_hack_req isn't freed

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#8500) packet_single_want_hack_req isn't freed
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Mon, 12 Apr 2004 16:15:21 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8500 >

On Mon, Apr 12, 2004 at 02:44:51PM -0700, Jason Short wrote:
> 
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=8500 >
> 
> jdorje@xxxxxxxxxxxx wrote:
> 
> > However this isn't clean because the caller gives us packet directly. 
> > It should be the caller who frees it.
> 
> And a patch.

I think it should be applied. However ...

>               command_ok = handle_packet_input(pconn, packet, type);
> -             packet = NULL;
> +             if (packet) {
> +               free(packet);
> +               packet = NULL;
> +             }

handle_packet_input can't return NULL here. result is true.

>               finish_processing_request(pconn);
>               connection_do_unbuffer(pconn);
> Index: server/srv_main.c
> ===================================================================
> RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
> retrieving revision 1.158
> diff -u -r1.158 srv_main.c
> --- server/srv_main.c 10 Apr 2004 03:47:50 -0000      1.158
> +++ server/srv_main.c 12 Apr 2004 21:43:32 -0000
> @@ -776,7 +776,6 @@
>      bool result =
>       handle_login_request(pconn,
>                            (struct packet_server_join_req *) packet);
> -    free(packet);
>      return result;
>    }

> @@ -786,20 +785,17 @@
>       handle_authentication_reply(pconn,
>                                   ((struct packet_authentication_reply *)
>                                    packet)->password);
> -    free(packet);
>      return result;

Remove the tmp variables.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Your mail could not be delivered to the following Address:
  VTCMC.VTLPR@xxxxxxxxxxxxx        ** Unassigned error message **"




[Prev in Thread] Current Thread [Next in Thread]