Fix use-after-free
authorPetr Machata <pmachata@redhat.com>
Wed, 6 Nov 2013 09:14:23 +0000 (10:14 +0100)
committerChanho Park <chanho61.park@samsung.com>
Fri, 22 Aug 2014 11:38:23 +0000 (20:38 +0900)
prototype.c

index 7f91897..a892666 100644 (file)
@@ -564,11 +564,11 @@ protolib_cache_maybe_load(struct protolib_cache *cache,
            || (*retp == NULL
                && load_config(cache, key, 0, retp) < 0))
        {
-               if (!own_key)
-                       free((void *) key);
                fprintf(stderr,
                        "Error occurred when attempting to load a prototype "
                        "library for %s.\n", key);
+               if (!own_key)
+                       free((void *) key);
                return -1;
        }