소스 검색

fixed 3 potential memory leaks

Felix Paul Kühne 12 년 전
부모
커밋
9841080849
2개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 0
      Sources/VLCEventManager.m
  2. 1 1
      Sources/VLCMediaList.m

+ 2 - 0
Sources/VLCEventManager.m

@@ -159,6 +159,7 @@ static void * EventDispatcherMainLoop(void * user_data)
             [self performSelectorOnMainThread:@selector(callObjectMethodWithArgs:)
                                    withObject:dataMessage
                                 waitUntilDone: YES];
+        [dataMessage autorelease];
 
         [pool drain];
     }
@@ -230,6 +231,7 @@ static void * EventDispatcherMainLoop(void * user_data)
         NSData *nsd_message = [NSData dataWithBytes:&message length:sizeof(message_t)];
         [self addMessageToHandleOnMainThread:nsd_message];
         [self callDelegateOfObjectAndSendNotificationWithArgs:[nsd_message retain] /* released in the call */];
+        [nsd_message autorelease];
     }
     else
     {

+ 1 - 1
Sources/VLCMediaList.m

@@ -139,7 +139,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
 
 - (void)removeMediaAtIndex:(NSInteger)index
 {
-    [[self mediaAtIndex:index] release];
+    [cachedMedia removeObjectAtIndex:index];
 
     // Remove it from the libvlc's medialist
     libvlc_media_list_remove_index(p_mlist, index);