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 .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
with:
engine: cruby
min_version: 2.4
versions: '["mswin", "mingw"]'
versions: '["mswin-head", "mswin-4.0", "mingw"]'

test:
needs: ruby-versions
Expand Down
42 changes: 21 additions & 21 deletions ext/win32ole/win32ole.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ static ULONG ( STDMETHODCALLTYPE Release )(
if (u == 0) {
st_data_t key = p->obj;
st_delete(DATA_PTR(com_hash), &key, 0);
free(p);
xfree(p);
}
return u;
}
Expand Down Expand Up @@ -353,7 +353,7 @@ static HRESULT ( STDMETHODCALLTYPE GetIDsOfNames )(
*/
char* psz = ole_wc2mb(*rgszNames); // support only one method
ID nameid = rb_check_id_cstr(psz, (long)strlen(psz), cWIN32OLE_enc);
free(psz);
xfree(psz);
if ((ID)(DISPID)nameid != nameid) return E_NOINTERFACE;
*rgDispId = (DISPID)nameid;
return S_OK;
Expand Down Expand Up @@ -790,8 +790,8 @@ ole_excepinfo2msg(EXCEPINFO *pExInfo)
else {
rb_str_cat2(error_msg, "<No Description>");
}
if(pSource) free(pSource);
if(pDescription) free(pDescription);
if(pSource) xfree(pSource);
if(pDescription) xfree(pDescription);
ole_freeexceptinfo(pExInfo);
return error_msg;
}
Expand Down Expand Up @@ -846,7 +846,7 @@ ole_free(void *ptr)
{
struct oledata *pole = ptr;
OLE_FREE(pole->pDispatch);
free(pole);
xfree(pole);
}

static size_t ole_size(const void *ptr)
Expand Down Expand Up @@ -1211,9 +1211,9 @@ ole_val_ary2variant_ary(VALUE val, VARIANT *var, VARTYPE vt)
pid = ALLOC_N(LONG, dim);

if(!psab || !pub || !pid) {
if(pub) free(pub);
if(psab) free(psab);
if(pid) free(pid);
if(pub) xfree(pub);
if(psab) xfree(psab);
if(pid) xfree(pid);
rb_raise(rb_eRuntimeError, "memory allocation error");
}

Expand All @@ -1237,9 +1237,9 @@ ole_val_ary2variant_ary(VALUE val, VARIANT *var, VARTYPE vt)
hr = SafeArrayUnlock(psa);
}

if(pub) free(pub);
if(psab) free(psab);
if(pid) free(pid);
if(pub) xfree(pub);
if(psab) xfree(psab);
if(pid) xfree(pid);

if (SUCCEEDED(hr)) {
V_VT(var) = vt;
Expand Down Expand Up @@ -1410,7 +1410,7 @@ ary_new_dim(VALUE myary, LONG *pid, LONG *plb, LONG dim) {
obj = rb_ary_entry(pobj, ids[i]);
pobj = obj;
}
if (ids) free(ids);
if (ids) xfree(ids);
return obj;
}

Expand Down Expand Up @@ -1450,9 +1450,9 @@ ole_variant2val(VARIANT *pvar)
pub = ALLOC_N(LONG, dim);

if(!pid || !plb || !pub) {
if(pid) free(pid);
if(plb) free(plb);
if(pub) free(pub);
if(pid) xfree(pid);
if(plb) xfree(plb);
if(pub) xfree(pub);
rb_raise(rb_eRuntimeError, "memory allocation error");
}

Expand Down Expand Up @@ -1491,9 +1491,9 @@ ole_variant2val(VARIANT *pvar)
}
SafeArrayUnlock(psa);
}
if(pid) free(pid);
if(plb) free(plb);
if(pub) free(pub);
if(pid) xfree(pid);
if(plb) xfree(plb);
if(pub) xfree(pub);
return obj;
}
switch(V_VT(pvar) & ~VT_BYREF){
Expand Down Expand Up @@ -1683,11 +1683,11 @@ reg_get_val(HKEY hkey, const char *subkey)
DWORD len = ExpandEnvironmentStrings(pbuf2, NULL, 0);
pbuf = ALLOC_N(char, len + 1);
ExpandEnvironmentStrings(pbuf2, pbuf, len + 1);
free(pbuf2);
xfree(pbuf2);
}
val = rb_str_new2((char *)pbuf);
}
free(pbuf);
xfree(pbuf);
}
return val;
}
Expand Down Expand Up @@ -1762,7 +1762,7 @@ ole_const_load(ITypeLib *pTypeLib, VALUE klass, VALUE self)
}
SysFreeString(bstr);
if(pName) {
free(pName);
xfree(pName);
pName = NULL;
}
}
Expand Down
6 changes: 3 additions & 3 deletions ext/win32ole/win32ole_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ EVENTSINK_Destructor(
) {
if(pEVObj != NULL) {
OLE_RELEASE(pEVObj->pTypeInfo);
free(pEVObj);
xfree(pEVObj);
pEVObj = NULL;
}
}
Expand Down Expand Up @@ -571,7 +571,7 @@ find_iid(VALUE ole, char *pitf, IID *piid, ITypeInfo **ppTypeInfo)
pImplTypeAttr);
}
}
free(pstr);
xfree(pstr);
OLE_RELEASE(pImplTypeInfo);
if (is_found || FAILED(hr))
break;
Expand Down Expand Up @@ -874,7 +874,7 @@ oleevent_free(void *ptr)
poleev->pConnectionPoint = NULL;
}
OLE_RELEASE(poleev->pDispatch);
free(poleev);
xfree(poleev);
}

static size_t
Expand Down
2 changes: 1 addition & 1 deletion ext/win32ole/win32ole_method.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ olemethod_free(void *ptr)
struct olemethoddata *polemethod = ptr;
OLE_FREE(polemethod->pTypeInfo);
OLE_FREE(polemethod->pOwnerTypeInfo);
free(polemethod);
xfree(polemethod);
}

static size_t
Expand Down
2 changes: 1 addition & 1 deletion ext/win32ole/win32ole_param.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ oleparam_free(void *ptr)
{
struct oleparamdata *pole = ptr;
OLE_FREE(pole->pTypeInfo);
free(pole);
xfree(pole);
}

static size_t
Expand Down
6 changes: 3 additions & 3 deletions ext/win32ole/win32ole_record.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ ole_rec2variant(VALUE rec, VARIANT *var)
ole_raise(hr, eWIN32OLERuntimeError, "failed to get size for allocation of VT_RECORD object");
}
if (prec->pdata) {
free(prec->pdata);
xfree(prec->pdata);
}
prec->pdata = ALLOC_N(char, size);
if (!prec->pdata) {
Expand Down Expand Up @@ -217,9 +217,9 @@ olerecord_free(void *ptr) {
struct olerecorddata *pvar = ptr;
OLE_FREE(pvar->pri);
if (pvar->pdata) {
free(pvar->pdata);
xfree(pvar->pdata);
}
free(pvar);
xfree(pvar);
}

static size_t
Expand Down
2 changes: 1 addition & 1 deletion ext/win32ole/win32ole_type.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ oletype_free(void *ptr)
{
struct oletypedata *poletype = ptr;
OLE_FREE(poletype->pTypeInfo);
free(poletype);
xfree(poletype);
}

static size_t
Expand Down
2 changes: 1 addition & 1 deletion ext/win32ole/win32ole_typelib.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ oletypelib_free(void *ptr)
{
struct oletypelibdata *poletypelib = ptr;
OLE_FREE(poletypelib->pTypeLib);
free(poletypelib);
xfree(poletypelib);
}

static size_t
Expand Down
2 changes: 1 addition & 1 deletion ext/win32ole/win32ole_variable.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ olevariable_free(void *ptr)
{
struct olevariabledata *polevar = ptr;
OLE_FREE(polevar->pTypeInfo);
free(polevar);
xfree(polevar);
}

static size_t
Expand Down
10 changes: 5 additions & 5 deletions ext/win32ole/win32ole_variant.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ olevariant_free(void *ptr)
struct olevariantdata *pvar = ptr;
VariantClear(&(pvar->realvar));
VariantClear(&(pvar->var));
free(pvar);
xfree(pvar);
}

static size_t
Expand Down Expand Up @@ -315,7 +315,7 @@ folevariant_s_array(VALUE klass, VALUE elems, VALUE vvt)

psa = SafeArrayCreate((VARTYPE)(vt & VT_TYPEMASK), dim, psab);
if (psa == NULL) {
if (psab) free(psab);
if (psab) xfree(psab);
rb_raise(rb_eRuntimeError, "memory allocation error(SafeArrayCreate)");
}

Expand All @@ -327,7 +327,7 @@ folevariant_s_array(VALUE klass, VALUE elems, VALUE vvt)
} else {
V_ARRAY(&(pvar->var)) = psa;
}
if (psab) free(psab);
if (psab) xfree(psab);
return obj;
}

Expand Down Expand Up @@ -531,7 +531,7 @@ folevariant_ary_aref(int argc, VALUE *argv, VALUE self)
val = ole_variant2val(&variant);

unlock_safe_array(psa);
if (pid) free(pid);
if (pid) xfree(pid);
return val;
}

Expand Down Expand Up @@ -592,7 +592,7 @@ folevariant_ary_aset(int argc, VALUE *argv, VALUE self)
}

unlock_safe_array(psa);
if (pid) free(pid);
if (pid) xfree(pid);
return argv[argc-1];
}

Expand Down