diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index cf74ec9..e439a5b 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -793,7 +793,8 @@ vee_search_by_uids(CamelFolder *folder, const char *expression, GPtrArray *uids,
 						vuid = g_malloc(strlen(uid)+9);
 						memcpy(vuid, hash, 8);
 						strcpy(vuid+8, uid);
-						g_ptr_array_add(result, vuid);
+						g_ptr_array_add(result, camel_pstring_strdup(vuid));
+						g_free(vuid);
 					}
 					camel_folder_search_free(f, matches);
 				} else {
