nfctype2: Fix possible memory leak in meta_recv
authorWiktor Lawski <wiktor.lawski@tieto.com>
Mon, 10 Sep 2012 07:43:25 +0000 (09:43 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 10 Sep 2012 08:41:46 +0000 (10:41 +0200)
Tag was not freed when data_read failed.

plugins/nfctype2.c

index 09954db..dc178ca 100644 (file)
@@ -248,12 +248,15 @@ static int meta_recv(uint8_t *resp, int length, void *data)
 
        err = data_read(t2_tag);
        if (err < 0)
-               goto out;
+               goto out_tag;
 
        t2_cookie_release(cookie);
 
        return 0;
 
+out_tag:
+       g_free(t2_tag);
+
 out:
        if (err < 0 && cookie->cb)
                cookie->cb(cookie->adapter_idx, cookie->target_idx, err);