Updated the class_copyMethodList
Updated the class_copyMethodList to clear the stack garbage for outCount if preset before checking the class is null
@@ -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;
