<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
<br>
> #include <libudev.h><br>
> #ifdef __linux__<br>
> #include <linux/limits.h><br>
> @@ -224,8 +224,8 @@ struct igt_device {<br>
> /* Point to vendor spec if can be found */<br>
> <br>
> /* Properties / sysattrs rewriten from udev lists */<br>
> - GHashTable *props_ht;<br>
> - GHashTable *attrs_ht;<br>
> + struct igt_map *props_map;<br>
> + struct igt_map *attrs_map;<br>
> <br>
> /* Most usable variables from udev device */<br>
> char *subsystem;<br>
> @@ -464,6 +464,11 @@ static bool is_on_blacklist(const char *what)<br>
> <br>
> }<br>
> <br>
> +static int key_equals(const void *key1, const void *key2)<br>
> +{<br>
> + return strcmp((char *)key1, (char *)key2) == 0;<br>
> +}<br>
> +<br>
> static struct igt_device *igt_device_new(void)<br>
> {<br>
> struct igt_device *dev;<br>
> @@ -472,14 +477,14 @@ static struct igt_device *igt_device_new(void)<br>
> if (!dev)<br>
> return NULL;<br>
> <br>
> - dev->attrs_ht = g_hash_table_new_full(g_str_hash, g_str_equal,<br>
> - free, free);<br>
> - dev->props_ht = g_hash_table_new_full(g_str_hash, g_str_equal,<br>
> - free, free);<br>
> + dev->attrs_map = igt_map_create(igt_map_hash_32, key_equals);<br>
> + dev->props_map = igt_map_create(igt_map_hash_32, key_equals);<br>
> <br>
> - if (dev->attrs_ht && dev->props_ht)<br>
> + if (dev->attrs_map && dev->props_map)<br>
> return dev;<br>
> <br>
> + igt_map_destroy(dev->attrs_map, NULL);<br>
> + igt_map_destroy(dev->props_map, NULL);<br>
<br>
> What for are you freeing the map here?<br>
</div>
<div class="elementToProof" style="font-size: 11pt; color: rgb(0, 0, 0);">map and also device is freed if creation of attrs_map or props_map fails.</div>
<div class="elementToProof" style="font-size: 11pt; color: rgb(0, 0, 0);"><br>
</div>
<div class="elementToProof" style="font-size: 11pt; color: rgb(0, 0, 0);">Thanks and Regards,</div>
<div class="elementToProof" style="font-size: 11pt; color: rgb(0, 0, 0);">Jeevaka</div>
</body>
</html>