If error occurred during parsing user should have
an opportunity to get details about place and type
of error.

Signed-off-by: Krzysztof Opasiak <k.opas...@samsung.com>
---
 src/usbg.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/usbg.c b/src/usbg.c
index 9d64171..4178194 100644
--- a/src/usbg.c
+++ b/src/usbg.c
@@ -42,6 +42,7 @@ struct usbg_state
        char *path;
 
        TAILQ_HEAD(ghead, usbg_gadget) gadgets;
+       config_t *last_failed_import;
 };
 
 struct usbg_gadget
@@ -590,6 +591,11 @@ static void usbg_free_state(usbg_state *s)
                usbg_free_gadget(g);
        }
 
+       if (s->last_failed_import) {
+               config_destroy(s->last_failed_import);
+               free(s->last_failed_import);
+       }
+
        free(s->path);
        free(s);
 }
@@ -1246,6 +1252,7 @@ static int usbg_init_state(char *path, usbg_state *s)
 
        /* State takes the ownership of path and should free it */
        s->path = path;
+       s->last_failed_import = NULL;
        TAILQ_INIT(&s->gadgets);
 
        ret = usbg_parse_gadgets(path, s);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to