aboutsummaryrefslogtreecommitdiff
path: root/src/pq/pq.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pq/pq.c')
-rw-r--r--src/pq/pq.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/pq/pq.c b/src/pq/pq.c
index 25202a640..356472fa3 100644
--- a/src/pq/pq.c
+++ b/src/pq/pq.c
@@ -128,9 +128,11 @@ GNUNET_PQ_extract_result (PGresult *result,
128 struct GNUNET_PQ_ResultSpec *rs, 128 struct GNUNET_PQ_ResultSpec *rs,
129 int row) 129 int row)
130{ 130{
131 unsigned int i;
132
131 if (NULL == result) 133 if (NULL == result)
132 return GNUNET_SYSERR; 134 return GNUNET_SYSERR;
133 for (unsigned int i = 0; NULL != rs[i].conv; i++) 135 for (i = 0; NULL != rs[i].conv; i++)
134 { 136 {
135 struct GNUNET_PQ_ResultSpec *spec; 137 struct GNUNET_PQ_ResultSpec *spec;
136 enum GNUNET_GenericReturnValue ret; 138 enum GNUNET_GenericReturnValue ret;
@@ -156,18 +158,24 @@ GNUNET_PQ_extract_result (PGresult *result,
156 *spec->is_null = true; 158 *spec->is_null = true;
157 continue; 159 continue;
158 } 160 }
159 /* intentional fall-through: NULL value for field that is NOT nullable */ 161 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
162 "NULL field encountered for `%s' where non-NULL was required\n",
163 spec->fname);
164 goto cleanup;
160 case GNUNET_SYSERR: 165 case GNUNET_SYSERR:
161 for (unsigned int j = 0; j < i; j++) 166 GNUNET_break (0);
162 if (NULL != rs[j].cleaner) 167 goto cleanup;
163 rs[j].cleaner (rs[j].cls,
164 rs[j].dst);
165 return GNUNET_SYSERR;
166 } 168 }
167 if (NULL != spec->result_size) 169 if (NULL != spec->result_size)
168 *spec->result_size = spec->dst_size; 170 *spec->result_size = spec->dst_size;
169 } 171 }
170 return GNUNET_OK; 172 return GNUNET_OK;
173cleanup:
174 for (unsigned int j = 0; j < i; j++)
175 if (NULL != rs[j].cleaner)
176 rs[j].cleaner (rs[j].cls,
177 rs[j].dst);
178 return GNUNET_SYSERR;
171} 179}
172 180
173 181