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 23:32:28 -0700
Reply-to: rt@xxxxxxxxxxx

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

On Mon, Apr 12, 2004 at 04:43:44PM -0700, Jason Short wrote:
> 
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=8500 >
> 
> Raimar Falke wrote:
> > <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.
> > 
> > 
> > And do the same thing to the client.
> 
> Easy enough, although this one isn't quite as helpful.

>    if (read_from_connection(&aconnection, FALSE) >= 0) {
>      enum packet_type type;

>      bool result;

Why not also move this?

> -    void *packet;
>  
>      while (TRUE) {
> -      packet = get_packet_from_connection(&aconnection, &type, &result);
> -      if (result) {
> +      void *packet = get_packet_from_connection(&aconnection,
> +                                             &type, &result);
> +

> +      if (result && packet) {

Can we change this to
> +      if (result) {
> +        assert(packet);

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 Q:  Do you know what the death rate around here is?
 A:  One per person.




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