chiark / gitweb /
sw_build: Bug squashing.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 18 Feb 2006 19:15:06 +0000 (19:15 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 18 Feb 2006 19:15:06 +0000 (19:15 +0000)
  * Report actual unexpected packet number, rather than an unhelpful
    `%i'.

  * Free each individual remote block, rather than the first one lots of
    times.  Fixes glibc heap error reported by David Kreil.

src/sw_build.c

index d8ec6ab1806373199f9b3625e8dccc5cd33d8b98..7b301935819a640c63d60eaf96197e79f7197387 100644 (file)
@@ -405,8 +405,10 @@ int sw_run(int argc, char *argv[])
          } break;
 
          default: {
-           const static char msg[] = "\n[Unexpected packet, type %i]\n";
-           p->output(e, msg, sizeof(msg) - 1);
+           dstr d = DSTR_INIT;
+           dstr_putf(&d, "\n[Unexpected packet, type %i]\n", t);
+           p->output(e, d.buf, d.len);
+           dstr_destroy(&d);
          } break;
        }
       }
@@ -444,7 +446,7 @@ int sw_run(int argc, char *argv[])
   {
     archcons *aa;
     for (aa = a; aa; aa = aa->cdr)
-      free(a->car->r);
+      free(aa->car->r);
   }
 
   /* --- Tidy away the architecture list --- */