pixtype = rt_band_get_pixtype(ctx, band);
result = palloc(VARHDRSZ + name_size);
- if ( ! result ) {
- elog(ERROR, "RASTER_getBandPixelTypeName: Could not allocate memory for output text object");
- PG_RETURN_NULL();
- }
+ /* We don't need to check for NULL pointer, because if out of memory, palloc
+ * exit via elog(ERROR). It never returns NULL.
+ */
+
memset(VARDATA(result), 0, name_size);
ptr = (char *)result + VARHDRSZ;
}
result = (text *) palloc(VARHDRSZ + strlen(bandpath) + 1);
- if ( ! result ) {
- elog(ERROR, "RASTER_getBandPath: Could not allocate memory for output text object");
- PG_RETURN_NULL();
- }
+
SET_VARSIZE(result, VARHDRSZ + strlen(bandpath) + 1);
strcpy((char *) VARDATA(result), bandpath);
result = palloc(size);
- if ( ! result )
- {
- ereport(ERROR, (errmsg_internal("Out of virtual memory")));
- return NULL;
- }
return result;
}