summaryrefslogtreecommitdiff
path: root/audio/mpg321/patches/patch-mpg321.c
blob: bea61cba29ae21031a06f414866d9132da15cf24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
$NetBSD: patch-mpg321.c,v 1.3 2018/07/08 13:42:13 leot Exp $

- Ensure structs are zero'd before use.
- Do not unlock uninitialized main_lock

--- mpg321.c.orig	2012-03-25 12:27:49.000000000 +0000
+++ mpg321.c
@@ -525,6 +525,7 @@ int main(int argc, char *argv[])
     
     old_dir[0] = '\0';
 
+    memset(&playbuf, 0, sizeof(playbuf));
     playbuf.pl = pl = new_playlist();
 
     if (!pl)
@@ -728,12 +729,13 @@ int main(int argc, char *argv[])
 //	    options.volume = mad_f_tofixed((long)100.0/100.0);
     }
 
+    sem_init(&main_lock,0,0);
+
     if (!(options.opt & MPG321_REMOTE_PLAY))
     {
 	     if(options.opt & MPG321_ENABLE_BASIC)
 	     {
 	 	     /* Now create and detach the basic controls thread */
-		     sem_init(&main_lock,0,0);
 	 	     pthread_create(&keyb_thread,NULL,read_keyb,NULL);
 		     pthread_detach(keyb_thread);
 	     }