Skip to content

Commit

Permalink
[FIX] Soothe valgrind by nulling out hoisted_method_list->obsolete,…
Browse files Browse the repository at this point in the history
… which it apparently reads. (Daniel Jalkut)
  • Loading branch information
rentzsch committed May 31, 2009
1 parent c01da30 commit 2f677d0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions JRSwizzle.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ + (BOOL)jr_swizzleMethod:(SEL)origSel_ withMethod:(SEL)altSel_ error:(NSError**)

int hoisted_method_count = !directOriginalMethod && !directAlternateMethod ? 2 : 1;
struct objc_method_list *hoisted_method_list = malloc(sizeof(struct objc_method_list) + (sizeof(struct objc_method)*(hoisted_method_count-1)));
hoisted_method_list->obsolete = NULL; // soothe valgrind - apparently ObjC runtime accesses this value and it shows as uninitialized in valgrind
hoisted_method_list->method_count = hoisted_method_count;
Method hoisted_method = hoisted_method_list->method_list;

Expand Down

1 comment on commit 2f677d0

@Curionloo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JRSwizzle.podspec

Please sign in to comment.