Fix trivial memory leak
PiperOrigin-RevId: 350427325 Change-Id: Iaa9f8da51410c46df87d4f826c20d2caafdb8f69
This commit is contained in:
parent
54eefc7307
commit
b9ce9cbc98
@ -98,11 +98,10 @@ JNIEXPORT jlongArray JNICALL Java_org_tensorflow_GraphOperation_shape(
|
||||
TF_Output output{op, output_index};
|
||||
TF_Status* status = TF_NewStatus();
|
||||
jsize num_dims = TF_GraphGetTensorNumDims(graph, output, status);
|
||||
if (!throwExceptionIfNotOK(env, status)) {
|
||||
if (!throwExceptionIfNotOK(env, status) || num_dims < 0) {
|
||||
TF_DeleteStatus(status);
|
||||
return nullptr;
|
||||
}
|
||||
if (num_dims < 0) return nullptr;
|
||||
static_assert(sizeof(jlong) == sizeof(int64_t),
|
||||
"Java long is not compatible with the TensorFlow C API");
|
||||
// One might have trivially wanted to do:
|
||||
|
Loading…
Reference in New Issue
Block a user