changeset 4539:8c2a166168dd

Fix a theoretical infinite loop: if plugin matches a mime-type, but probe function does not recognize contents, input probing gets into a infinite loop.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 11 May 2008 01:40:50 +0300
parents 04da24c63467
children 956272f5935d
files src/audacious/input.c
diffstat 1 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/input.c	Sat May 10 22:47:49 2008 +0300
+++ b/src/audacious/input.c	Sun May 11 01:40:50 2008 +0300
@@ -399,18 +399,18 @@
 
     // apply mimetype check. note that stdio does not support mimetype check.
     mimetype = vfs_get_metadata(fd, "content-type");
-    if ((ip = mime_get_plugin(mimetype)) != NULL && ip->enabled) {
-        while(1) {
-            if (!ip || !ip->enabled)
-                continue;
-
-            pr = input_do_check_file(ip, fd, filename_proxy, loading);
-
-            if(pr) {
-                g_free(filename_proxy);
-                vfs_fclose(fd);
-                return pr;
-            }
+    if (mimetype) {
+        ip = mime_get_plugin(mimetype);
+        g_free(mimetype);
+    } else
+        ip = NULL;
+    
+    if (ip && ip->enabled) {
+        pr = input_do_check_file(ip, fd, filename_proxy, loading);
+        if (pr) {
+            g_free(filename_proxy);
+            vfs_fclose(fd);
+            return pr;
         }
     }