diff options
-rw-r--r-- | src/postgres/postgres.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/postgres/postgres.c b/src/postgres/postgres.c index 4798c129d..14095c5a4 100644 --- a/src/postgres/postgres.c +++ b/src/postgres/postgres.c | |||
@@ -182,22 +182,22 @@ GNUNET_POSTGRES_connect (const struct GNUNET_CONFIGURATION_Handle * cfg, | |||
182 | &conninfo)) | 182 | &conninfo)) |
183 | conninfo = NULL; | 183 | conninfo = NULL; |
184 | dbh = PQconnectdb (conninfo == NULL ? "" : conninfo); | 184 | dbh = PQconnectdb (conninfo == NULL ? "" : conninfo); |
185 | GNUNET_free_non_null (conninfo); | 185 | |
186 | if (NULL == dbh) | 186 | if (NULL != dbh) |
187 | { | ||
188 | /* FIXME: warn about out-of-memory? */ | ||
189 | return NULL; | ||
190 | } | ||
191 | if (PQstatus (dbh) != CONNECTION_OK) | ||
192 | { | 187 | { |
193 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, | 188 | if (PQstatus (dbh) != CONNECTION_OK) |
194 | "postgres", | 189 | { |
195 | _("Unable to connect to Postgres database '%s': %s\n"), | 190 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, |
196 | conninfo, | 191 | "postgres", |
197 | PQerrorMessage (dbh)); | 192 | _("Unable to connect to Postgres database '%s': %s\n"), |
198 | PQfinish (dbh); | 193 | conninfo, |
199 | return NULL; | 194 | PQerrorMessage (dbh)); |
195 | PQfinish (dbh); | ||
196 | dbh = NULL; | ||
197 | } | ||
200 | } | 198 | } |
199 | // FIXME: warn about out-of-memory when dbh is NULL? | ||
200 | GNUNET_free_non_null (conninfo); | ||
201 | return dbh; | 201 | return dbh; |
202 | } | 202 | } |
203 | 203 | ||