Skip to content

Commit c71ae6e

Browse files
committed
pgvalue_vec_push can fails (it now return a bool)
1 parent d179b1c commit c71ae6e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/postgresql/pgvalue.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,18 @@ int pgvalue_dbtype(pgvalue_t *v) {
7474
}
7575
}
7676

77-
static void pgvalue_vec_push(pgvalue_t ***arr, int *count, int *cap, pgvalue_t *val) {
77+
static bool pgvalue_vec_push(pgvalue_t ***arr, int *count, int *cap, pgvalue_t *val) {
7878
if (*cap == 0) {
7979
*cap = 8;
8080
*arr = (pgvalue_t **)cloudsync_memory_zeroalloc(sizeof(pgvalue_t *) * (*cap));
81+
if (*arr) return false;
8182
} else if (*count >= *cap) {
8283
*cap *= 2;
8384
*arr = (pgvalue_t **)cloudsync_memory_realloc(*arr, sizeof(pgvalue_t *) * (*cap));
85+
if (*arr) return false;
8486
}
8587
(*arr)[(*count)++] = val;
88+
return true;
8689
}
8790

8891
pgvalue_t **pgvalues_from_array(ArrayType *array, int *out_count) {

0 commit comments

Comments
 (0)