From: Kern Sibbald Date: Sat, 28 Jul 2007 09:16:24 +0000 (+0000) Subject: Correct seg fault in postgresql when first operation returns no X-Git-Tag: Release-7.0.0~5931 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5af50073517e82fce0aae1573fd7fbdb9af686a1;p=bacula%2Fbacula Correct seg fault in postgresql when first operation returns no rows. Fixes Dirks File browser problem seg fault with bat. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5255 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/kernstodo b/bacula/kernstodo index 7b3567524a..3fe82faffa 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -58,6 +58,7 @@ Professional Needs: http://www.microsoft.com/technet/itshowcase/content/exchbkup.mspx Priority: +- Implement USB keyboard support in rescue CD. - Remove all install temp files in Win32 PLUGINSDIR. - Audit retention periods to make sure everything is 64 bit. - Use E'xxx' to escape PostgreSQL strings. diff --git a/bacula/src/cats/postgresql.c b/bacula/src/cats/postgresql.c index bc5190e70b..45d71b0167 100644 --- a/bacula/src/cats/postgresql.c +++ b/bacula/src/cats/postgresql.c @@ -341,14 +341,16 @@ POSTGRESQL_ROW my_postgresql_fetch_row(B_DB *mdb) Dmsg0(500, "my_postgresql_fetch_row start\n"); if (!mdb->row || mdb->row_size < mdb->num_fields) { + int num_fields = mdb->num_fields; Dmsg1(500, "we have need space of %d bytes\n", sizeof(char *) * mdb->num_fields); if (mdb->row) { Dmsg0(500, "my_postgresql_fetch_row freeing space\n"); free(mdb->row); } - mdb->row = (POSTGRESQL_ROW) malloc(sizeof(char *) * mdb->num_fields); - mdb->row_size = mdb->num_fields; + num_fields += 20; /* add a bit extra */ + mdb->row = (POSTGRESQL_ROW)malloc(sizeof(char *) * num_fields); + mdb->row_size = num_fields; // now reset the row_number now that we have the space allocated mdb->row_number = 0; diff --git a/bacula/src/version.h b/bacula/src/version.h index 7d494c4d73..6c86078834 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.1.29" -#define BDATE "26 July 2007" -#define LSMDATE "26Jul07" +#define BDATE "28 July 2007" +#define LSMDATE "28Jul07" #define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n" #define BYEAR "2007" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index 7fbdc0802f..de0940c582 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -1,6 +1,9 @@ Technical notes on version 2.1 General: +28Jul07 +kes Correct seg fault in postgresql when first operation returns no + rows. Fixes Dirks File browser problem seg fault with bat. 25Jul07 kes Apply patch from Felix Schwarz that allows building wxconsole on Fedora 7 with wxWidgets 2.8 (it works with