예제 #1
0
static struct NaClDesc *NaClResourceNullFactory(void) {
  struct NaClDescNull *null_desc = NULL;

  null_desc = malloc(sizeof *null_desc);
  if (NULL == null_desc) {
    return NULL;
  }
  if (!NaClDescNullCtor(null_desc)) {
    free(null_desc);
    null_desc = NULL;
  }
  return (struct NaClDesc *) null_desc;
}
예제 #2
0
int NaClDescNullInternalize(struct NaClDesc **out_desc,
                            struct NaClDescXferState *xfer,
                            struct NaClDescQuotaInterface *quota_interface) {
  int rv;
  struct NaClDescNull *d_null = malloc(sizeof *d_null);

  UNREFERENCED_PARAMETER(xfer);
  UNREFERENCED_PARAMETER(quota_interface);
  if (NULL == d_null) {
    rv = -NACL_ABI_ENOMEM;
    goto cleanup;
  }
  if (!NaClDescNullCtor(d_null)) {
    rv = -NACL_ABI_EIO;
    goto cleanup;
  }
  *out_desc = (struct NaClDesc *) d_null;
  rv = 0;  /* yay! */
 cleanup:
  return rv;
}