From: Robert Lipe Date: Tue, 31 Jul 2018 00:29:14 +0000 (-0500) Subject: Fix crash in -^ generating doc list X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~12^2~8^2~86^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1adfbe0d0225818348b1cec8b04eaeba657315bb;p=gpsbabel.git Fix crash in -^ generating doc list vecs_t is no longer a struct of POD. It’s now a class and has to be allocated by new. I hope to not have to rathole in vets for this change because it’s full of scary memory management like this. --- diff --git a/vecs.cc b/vecs.cc index f04bfd74d..b4c2d4a73 100644 --- a/vecs.cc +++ b/vecs.cc @@ -23,6 +23,8 @@ #include "csv_util.h" #include "gbversion.h" #include "inifile.h" +#include "QtCore/QDebug" +#include #include #include // qsort @@ -1483,7 +1485,7 @@ sort_and_unify_vecs(int* ctp) /* Walk the style list, parse the entries, dummy up a "normal" vec */ for (style_vecs_t* svec = style_list; svec->name; svec++, i++) { xcsv_read_internal_style(svec->style_buf); - svp[i] = (vecs_t*) xcalloc(1, sizeof** svp); + svp[i] = new vecs_t; svp[i]->name = svec->name; svp[i]->vec = (ff_vecs_t*) xmalloc(sizeof(*svp[i]->vec)); svp[i]->extensions = xcsv_file.extension; @@ -1677,7 +1679,6 @@ disp_formats(int version) vecs_t** svp; vecs_t* vec; int vc = 0; - switch (version) { case 0: case 1: @@ -1701,7 +1702,7 @@ disp_formats(int version) disp_v2(vec->vec); } printf("%s\t%s\t%s%s%s\n", vec->name, - CSTR(vec->extensions) ? CSTR(vec->extensions) : "", + !vec->extensions.isEmpty() ? CSTR(vec->extensions) : "", CSTR(vec->desc), version >= 3 ? "\t" : "", version >= 3 ? vec->parent : "");