Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Pythonwin/win32view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -839,8 +839,8 @@ static PyObject *ui_edit_window_save_file(PyObject *self, PyObject *args)
CDocument *pDocument = pView->GetDocument();
if (pDocument)
pDocument->SetModifiedFlag(FALSE); // start off with unmodified
PyWinObject_FreeTCHAR(fileName);
GUI_END_SAVE;
PyWinObject_FreeTCHAR(fileName);
RETURN_NONE;
}
// @pymethod tuple|PyCEditView|PreCreateWindow|Calls the underlying MFC PreCreateWindow method.
Expand Down
2 changes: 1 addition & 1 deletion Pythonwin/win32win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1654,9 +1654,9 @@ static PyObject *ui_window_message_box(PyObject *self, PyObject *args)
// @pyseemfc CWnd|MessageBox

rc = pWnd->MessageBox(message, title, style);
GUI_END_SAVE;
PyWinObject_FreeTCHAR(message);
PyWinObject_FreeTCHAR(title);
GUI_END_SAVE;
return Py_BuildValue("i", rc);
// @rdesc An integer identifying the button pressed to dismiss the dialog.
}
Expand Down
2 changes: 1 addition & 1 deletion com/win32com/src/extensions/PyIType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -688,8 +688,8 @@ PyObject *pythoncom_loadtypelib(PyObject *self, PyObject *args)
ITypeLib *ptl;
PY_INTERFACE_PRECALL;
SCODE sc = LoadTypeLib(bstrName, &ptl);
PyWinObject_FreeBstr(bstrName);
PY_INTERFACE_POSTCALL;
PyWinObject_FreeBstr(bstrName);
if (FAILED(sc))
return PyCom_BuildPyException(sc);

Expand Down
2 changes: 1 addition & 1 deletion com/win32comext/bits/src/PyIBackgroundCopyJob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,9 @@ PyObject *PyIBackgroundCopyJob::SetProxySettings(PyObject *self, PyObject *args)
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIBCJ->SetProxySettings(ProxyUsage, ProxyList, ProxyBypassList);
PY_INTERFACE_POSTCALL;
PyWinObject_FreeWCHAR(ProxyList);
PyWinObject_FreeWCHAR(ProxyBypassList);
PY_INTERFACE_POSTCALL;
if (FAILED(hr))
return PyCom_BuildPyException(hr, pIBCJ, IID_IBackgroundCopyJob);
Py_INCREF(Py_None);
Expand Down
2 changes: 1 addition & 1 deletion com/win32comext/internet/src/PyIDocHostUIHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,8 @@ PyObject *PyIDocHostUIHandler::TranslateUrl(PyObject *self, PyObject *args)
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIDHUIH->TranslateUrl(dwTranslate, pchURLIn, &pchURLOut);
PyWinObject_FreeWCHAR(pchURLIn);
PY_INTERFACE_POSTCALL;
PyWinObject_FreeWCHAR(pchURLIn);
if (FAILED(hr))
return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler);
PyObject *pyretval = MakeOLECHARToObj(pchURLOut);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ PyObject *PyIInternetSecurityManager::ProcessUrlAction(PyObject *self, PyObject
PY_INTERFACE_PRECALL;
hr = pIISM->ProcessUrlAction(pwszUrl, dwAction, (BYTE *)&dwPolicy, sizeof(dwPolicy), (BYTE *)context, cbcontext,
dwFlags, 0);
PyWinObject_FreeWCHAR(pwszUrl);
PY_INTERFACE_POSTCALL;
PyWinObject_FreeWCHAR(pwszUrl);
if (FAILED(hr))
return PyCom_BuildPyException(hr, pIISM, IID_IInternetSecurityManager);
return Py_BuildValue("ll", hr, dwPolicy);
Expand Down
7 changes: 3 additions & 4 deletions com/win32comext/shell/src/PyICopyHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,10 @@ PyObject *PyICopyHookA::CopyCallback(PyObject *self, PyObject *args)
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pICH->CopyCallback(hwnd, wFunc, wFlags, srcFile, srcAttribs, destFile, destAttribs);
PY_INTERFACE_POSTCALL;
PyWinObject_FreeChars(srcFile);
PyWinObject_FreeChars(destFile);

PY_INTERFACE_POSTCALL;

if (FAILED(hr))
return PyCom_BuildPyException(hr, pICH, IID_IShellCopyHook);
Py_INCREF(Py_None);
Expand Down Expand Up @@ -143,10 +142,10 @@ PyObject *PyICopyHookW::CopyCallback(PyObject *self, PyObject *args)
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pICH->CopyCallback(hwnd, wFunc, wFlags, srcFile, srcAttribs, destFile, destAttribs);
PyWinObject_FreeWCHAR(srcFile);
PyWinObject_FreeWCHAR(destFile);

PY_INTERFACE_POSTCALL;
PyWinObject_FreeWCHAR(srcFile);
PyWinObject_FreeWCHAR(destFile);

if (FAILED(hr))
return PyCom_BuildPyException(hr, pICH, IID_IShellCopyHook);
Expand Down
3 changes: 2 additions & 1 deletion com/win32comext/shell/src/PyIExtractIcon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ PyObject *PyIExtractIcon::Extract(PyObject *self, PyObject *args)
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIEI->Extract(pszFile, nIconIndex, &hiconLarge, &hiconSmall, nIconSize);
PyWinObject_FreeChars(pszFile);
PY_INTERFACE_POSTCALL;
PyWinObject_FreeChars(pszFile);

if (FAILED(hr))
return PyCom_BuildPyException(hr, pIEI, IID_IExtractIcon);
if (hr == S_FALSE)
Expand Down
3 changes: 2 additions & 1 deletion com/win32comext/shell/src/PyIExtractIconW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ PyObject *PyIExtractIconW::Extract(PyObject *self, PyObject *args)
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIEI->Extract(pszFile, nIconIndex, &hiconLarge, &hiconSmall, nIconSize);
PyWinObject_FreeWCHAR(pszFile);
PY_INTERFACE_POSTCALL;
PyWinObject_FreeWCHAR(pszFile);

if (FAILED(hr))
return PyCom_BuildPyException(hr, pIEI, IID_IExtractIconW);
if (hr == S_FALSE)
Expand Down
7 changes: 4 additions & 3 deletions com/win32comext/shell/src/PyIQueryAssociations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ PyObject *PyIQueryAssociations::Init(PyObject *self, PyObject *args)
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIQA->Init(flags, pszAssoc, hkProgid, hwnd);
PyWinObject_FreeWCHAR(pszAssoc);
PY_INTERFACE_POSTCALL;
PyWinObject_FreeWCHAR(pszAssoc);

if (FAILED(hr))
return PyCom_BuildPyException(hr, pIQA, IID_IQueryAssociations);
Py_INCREF(Py_None);
Expand Down Expand Up @@ -77,8 +78,8 @@ PyObject *PyIQueryAssociations::GetKey(PyObject *self, PyObject *args)
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIQA->GetKey(flags, (ASSOCKEY)assoc, pszExtra, &ret);
PyWinObject_FreeWCHAR(pszExtra);
PY_INTERFACE_POSTCALL;
PyWinObject_FreeWCHAR(pszExtra);
if (FAILED(hr))
return PyCom_BuildPyException(hr, pIQA, IID_IQueryAssociations);
// observation of the "open handles" count in task-manager indicates
Expand Down Expand Up @@ -116,8 +117,8 @@ PyObject *PyIQueryAssociations::GetString(PyObject *self, PyObject *args)
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIQA->GetString(flags, (ASSOCSTR)assoc, pszExtra, result_buf, &result_size);
PyWinObject_FreeWCHAR(pszExtra);
PY_INTERFACE_POSTCALL;
PyWinObject_FreeWCHAR(pszExtra);
if (FAILED(hr))
return PyCom_BuildPyException(hr, pIQA, IID_IQueryAssociations);
// docs don't explicitly say if result_size includes NULL. It says:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ PyObject *PyIShellIconOverlayIdentifier::IsMemberOf(PyObject *self, PyObject *ar
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pISIOI->IsMemberOf(path, attrib);
PyWinObject_FreeWCHAR(path);

PY_INTERFACE_POSTCALL;
PyWinObject_FreeWCHAR(path);

if (FAILED(hr))
return PyCom_BuildPyException(hr, pISIOI, IID_IShellIconOverlayIdentifier);
Expand Down
2 changes: 1 addition & 1 deletion com/win32comext/shell/src/shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -855,11 +855,11 @@ void PyObject_CleanupDEFCONTEXTMENU(DEFCONTEXTMENU *dcm)
dcm->psf->Release();
if (dcm->punkAssociationInfo)
dcm->punkAssociationInfo->Release();
PY_INTERFACE_POSTCALL;
if (dcm->pidlFolder)
PyObject_FreePIDL(dcm->pidlFolder);
if (dcm->apidl)
PyObject_FreePIDLArray(dcm->cidl, dcm->apidl);
PY_INTERFACE_POSTCALL;
}

// @object DEFCONTENTMENU|A tuple representing a DEFCONTEXTMENU structure.
Expand Down
8 changes: 3 additions & 5 deletions com/win32comext/taskscheduler/src/PyIScheduledWorkItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,8 @@ PyObject *PyIScheduledWorkItem::SetComment(PyObject *self, PyObject *args)
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pISWI->SetComment(pwszComment);
PyWinObject_FreeWCHAR(pwszComment);

PY_INTERFACE_POSTCALL;
PyWinObject_FreeWCHAR(pwszComment);

if (FAILED(hr))
return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem);
Expand Down Expand Up @@ -437,9 +436,8 @@ PyObject *PyIScheduledWorkItem::SetCreator(PyObject *self, PyObject *args)
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pISWI->SetCreator(pwszCreator);
PyWinObject_FreeWCHAR(pwszCreator);

PY_INTERFACE_POSTCALL;
PyWinObject_FreeWCHAR(pwszCreator);

if (FAILED(hr))
return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem);
Expand Down Expand Up @@ -685,9 +683,9 @@ PyObject *PyIScheduledWorkItem::SetAccountInformation(PyObject *self, PyObject *
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pISWI->SetAccountInformation(AccountName, Password);
PY_INTERFACE_POSTCALL;
PyWinObject_FreeWCHAR(AccountName);
PyWinObject_FreeWCHAR(Password);
PY_INTERFACE_POSTCALL;

if (FAILED(hr))
return PyCom_BuildPyException(hr, pISWI, IID_IScheduledWorkItem);
Expand Down
6 changes: 2 additions & 4 deletions com/win32comext/taskscheduler/src/PyITask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ PyObject *PyITask::SetApplicationName(PyObject *self, PyObject *args)
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIT->SetApplicationName(pwszApplicationName);
PyWinObject_FreeWCHAR(pwszApplicationName);

PY_INTERFACE_POSTCALL;
PyWinObject_FreeWCHAR(pwszApplicationName);

if (FAILED(hr))
return PyCom_BuildPyException(hr, pIT, IID_ITask);
Expand Down Expand Up @@ -80,9 +79,8 @@ PyObject *PyITask::SetParameters(PyObject *self, PyObject *args)
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIT->SetParameters(pwszParameters);
PyWinObject_FreeWCHAR(pwszParameters);

PY_INTERFACE_POSTCALL;
PyWinObject_FreeWCHAR(pwszParameters);

if (FAILED(hr))
return PyCom_BuildPyException(hr, pIT, IID_ITask);
Expand Down
2 changes: 1 addition & 1 deletion com/win32comext/taskscheduler/src/PyITaskScheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ PyObject *PyITaskScheduler::SetTargetComputer(PyObject *self, PyObject *args)
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pITS->SetTargetComputer(Computer);
PyWinObject_FreeWCHAR(Computer);
PY_INTERFACE_POSTCALL;
PyWinObject_FreeWCHAR(Computer);

if (FAILED(hr))
return PyCom_BuildPyException(hr, pITS, IID_ITaskScheduler);
Expand Down