[grilo-plugins] lua-factory: Remove confusing fetch_op_cleanup



commit 4a7a65b92a3367161df53278b278c9db6e95a83b
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Feb 26 14:42:15 2014 +0100

    lua-factory: Remove confusing fetch_op_cleanup
    
    fetch_op_cleanup didn't really cleanup the whole operation structure.
    Instead, clean up what we need to and wait for the rest of the
    operations to complete.

 src/lua-factory/grl-lua-library.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/lua-factory/grl-lua-library.c b/src/lua-factory/grl-lua-library.c
index 158bc08..7502334 100644
--- a/src/lua-factory/grl-lua-library.c
+++ b/src/lua-factory/grl-lua-library.c
@@ -214,10 +214,16 @@ grl_util_fetch_done (GObject *source_object,
     GRL_DEBUG ("fetch_done element %d of %d urls", fo->index + 1, fo->num_urls);
   }
 
-  /* Check if we finished fetching urls */
-  for (i = 0; i < fo->num_urls; i++)
-    if (fo->results[i] == NULL)
-      goto fetch_op_cleanup;
+  /* Check if we finished fetching URLs */
+  for (i = 0; i < fo->num_urls; i++) {
+    if (fo->results[i] == NULL) {
+      /* Clean up this operation, and wait for
+       * other operations to complete */
+      g_free (fo->lua_cb);
+      g_free (fo);
+      return;
+    }
+  }
 
   lua_getglobal (L, fo->lua_cb);
 
@@ -240,8 +246,6 @@ grl_util_fetch_done (GObject *source_object,
   for (i = 0; i < fo->num_urls; i++)
     g_free (fo->results[i]);
   g_free (fo->results);
-
-fetch_op_cleanup:
   g_free (fo->lua_cb);
   g_free (fo);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]