Browse Source

main: Join threads only if they are initialized.

This fix prevents segfault on exit.
Georgi Chorbadzhiyski 12 years ago
parent
commit
ffb1a883f6
1 changed files with 4 additions and 2 deletions
  1. 4
    2
      tsdecrypt.c

+ 4
- 2
tsdecrypt.c View File

@@ -593,8 +593,10 @@ EXIT:
593 593
 		ts.decode_stop = 1;
594 594
 		ts.write_stop = 1;
595 595
 
596
-		pthread_join(ts.decode_thread, NULL);
597
-		pthread_join(ts.write_thread, NULL);
596
+		if (ts.decode_thread)
597
+			pthread_join(ts.decode_thread, NULL);
598
+		if (ts.write_thread)
599
+			pthread_join(ts.write_thread, NULL);
598 600
 	}
599 601
 
600 602
 	data_free(&ts);

Loading…
Cancel
Save