Hi!

On Thu, 2016-11-10 at 16:24:13 +0100, Guillem Jover wrote:
> This appears to be a problem with reportbroken_retexitstatus() in
> src/error.c when printing out the packages affected by the errors, so
> not something dangerous, but still annoying and wrong.
> 
> From your backtrace it seems the function which has accumulated the
> package names cannot access those pointers anymore. And even though I
> cannot reproduce I think I know what's going on.
> 
> The latest releases started freeing the memory pool when releaseing
> the database journal. Which means that this invalidates those stored
> references. I'll copy those strings for the next release so that we
> can still free the db.
> 
> If you can still reproduce at will, I might like to provide a patch to
> make sure the fix works for you? If you could test this, probably
> later today, that'd be awesome!

Ok, it was too trivial to leave alone. :) Attached the proposed patch.

Thanks,
Guillem
diff --git i/src/errors.c w/src/errors.c
index 0869235..d580e35 100644
--- i/src/errors.c
+++ w/src/errors.c
@@ -47,7 +47,7 @@ static int nerrs = 0;
 
 struct error_report {
   struct error_report *next;
-  const char *what;
+  char *what;
 };
 
 static struct error_report *reports = NULL;
@@ -66,7 +66,7 @@ enqueue_error_report(const char *arg)
     abort_processing = true;
     nr= &emergency;
   }
-  nr->what= arg;
+  nr->what = strdup(arg);
   nr->next = NULL;
   *lastreport= nr;
   lastreport= &nr->next;
@@ -109,6 +109,7 @@ reportbroken_retexitstatus(int ret)
     fputs(_("Errors were encountered while processing:\n"),stderr);
     while (reports) {
       fprintf(stderr," %s\n",reports->what);
+      free(reports->what);
       reports= reports->next;
     }
   }

Reply via email to