summaryrefslogtreecommitdiff
path: root/torch
diff options
context:
space:
mode:
authorWill Feng <willfeng@fb.com>2018-07-16 19:18:33 -0700
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2018-07-16 19:25:22 -0700
commitad74006ffa22c79285e21c7777e9d386607ebbea (patch)
treeab2d932bc9515aaa1f70b63bda0f5005e52f578e /torch
parentc4bff252821743cf64c30336d5ce6ce0457e2a34 (diff)
downloadpytorch-ad74006ffa22c79285e21c7777e9d386607ebbea.tar.gz
pytorch-ad74006ffa22c79285e21c7777e9d386607ebbea.tar.bz2
pytorch-ad74006ffa22c79285e21c7777e9d386607ebbea.zip
Pass THDRequest as void* pointer to THDRequest_free (#9398)
Summary: This fixes https://github.com/pytorch/pytorch/issues/9054. Pull Request resolved: https://github.com/pytorch/pytorch/pull/9398 Reviewed By: ezyang Differential Revision: D8827778 Pulled By: yf225 fbshipit-source-id: 862287802cb69c6ac71ff4df19cadb89b1face1d
Diffstat (limited to 'torch')
-rw-r--r--torch/csrc/PtrWrapper.cpp3
-rw-r--r--torch/lib/THD/base/DataChannelRequest.cpp4
-rw-r--r--torch/lib/THD/base/DataChannelRequest.h2
3 files changed, 4 insertions, 5 deletions
diff --git a/torch/csrc/PtrWrapper.cpp b/torch/csrc/PtrWrapper.cpp
index 544895bfd0..52d7b1f140 100644
--- a/torch/csrc/PtrWrapper.cpp
+++ b/torch/csrc/PtrWrapper.cpp
@@ -45,8 +45,7 @@ static PyObject * THPWrapper_pynew(PyTypeObject *type, PyObject *args, PyObject
return self;
}
-// UBSAN error: https://github.com/pytorch/pytorch/issues/9054
-static void THPWrapper_dealloc(THPWrapper* self) __ubsan_ignore_function__
+static void THPWrapper_dealloc(THPWrapper* self)
{
self->destructor(self->data);
Py_TYPE(self)->tp_free((PyObject*)self);
diff --git a/torch/lib/THD/base/DataChannelRequest.cpp b/torch/lib/THD/base/DataChannelRequest.cpp
index 13540e4337..a9536b4a44 100644
--- a/torch/lib/THD/base/DataChannelRequest.cpp
+++ b/torch/lib/THD/base/DataChannelRequest.cpp
@@ -1,6 +1,6 @@
#include "DataChannelRequest.hpp"
-THD_API void THDRequest_free(THDRequest* request) {
- delete request;
+THD_API void THDRequest_free(void* request) {
+ delete (THDRequest*)request;
}
diff --git a/torch/lib/THD/base/DataChannelRequest.h b/torch/lib/THD/base/DataChannelRequest.h
index 8112c71882..3a1d70dea2 100644
--- a/torch/lib/THD/base/DataChannelRequest.h
+++ b/torch/lib/THD/base/DataChannelRequest.h
@@ -7,4 +7,4 @@ struct _THDRequest;
typedef struct _THDRequest THDRequest;
#endif
-THD_API void THDRequest_free(THDRequest* req);
+THD_API void THDRequest_free(void* req);