ima: free duplicate measurement memory
[linux-2.6.git] / security / integrity / ima / ima_api.c
index 0d50df0..88a2788 100644 (file)
@@ -178,8 +178,8 @@ void ima_store_measurement(struct integrity_iint_cache *iint,
        strncpy(entry->template.file_name, filename, IMA_EVENT_NAME_LEN_MAX);
 
        result = ima_store_template(entry, violation, inode);
-       if (!result)
+       if (!result || result == -EEXIST)
                iint->flags |= IMA_MEASURED;
-       else
+       if (result < 0)
                kfree(entry);
 }