Updated the class_copyMethodList (#206)

Updated the class_copyMethodList to clear the stack garbage for outCount if preset before checking the class is null
main
mischievous 5 years ago committed by GitHub
parent 921e3c3386
commit 1094eb7a1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -208,6 +208,11 @@ BOOL class_addProtocol(Class cls, Protocol *protocol)
Ivar * class_copyIvarList(Class cls, unsigned int *outCount)
{
if (outCount != NULL)
{
*outCount = 0x0;
}
CHECK_ARG(cls);
struct objc_ivar_list *ivarlist = NULL;
unsigned int count = 0;
@ -244,6 +249,11 @@ Ivar * class_copyIvarList(Class cls, unsigned int *outCount)
Method * class_copyMethodList(Class cls, unsigned int *outCount)
{
if (outCount != NULL)
{
*outCount = 0x0;
}
CHECK_ARG(cls);
unsigned int count = 0;
Method *list;
@ -256,10 +266,12 @@ Method * class_copyMethodList(Class cls, unsigned int *outCount)
count += methods->count;
}
}
if (outCount != NULL)
{
*outCount = count;
}
if (count == 0)
{
return NULL;
@ -282,6 +294,11 @@ Method * class_copyMethodList(Class cls, unsigned int *outCount)
Protocol*__unsafe_unretained* class_copyProtocolList(Class cls, unsigned int *outCount)
{
if (outCount != NULL)
{
*outCount = 0x0;
}
CHECK_ARG(cls);
struct objc_protocol_list *protocolList = NULL;
struct objc_protocol_list *list;

Loading…
Cancel
Save