mirror of https://github.com/djcb/mu.git
* small leak fixes
This commit is contained in:
parent
0a15f82ede
commit
d421f4bff6
|
@ -201,7 +201,8 @@ static void
|
||||||
each_part (MuMsg *msg, MuMsgPart *part, gchar **parts)
|
each_part (MuMsg *msg, MuMsgPart *part, gchar **parts)
|
||||||
{
|
{
|
||||||
const char *fname;
|
const char *fname;
|
||||||
char *name;
|
char *name, *tmp;
|
||||||
|
|
||||||
|
|
||||||
if (!mu_msg_part_looks_like_attachment (part, TRUE))
|
if (!mu_msg_part_looks_like_attachment (part, TRUE))
|
||||||
return;
|
return;
|
||||||
|
@ -215,12 +216,15 @@ each_part (MuMsg *msg, MuMsgPart *part, gchar **parts)
|
||||||
else
|
else
|
||||||
name = g_strdup_printf ("\"part-%d\"", part->index);
|
name = g_strdup_printf ("\"part-%d\"", part->index);
|
||||||
|
|
||||||
*parts = g_strdup_printf
|
tmp = g_strdup_printf
|
||||||
("%s(:index %d :name %s :mime-type \"%s/%s\" :size %u)",
|
("%s(:index %d :name %s :mime-type \"%s/%s\" :size %u)",
|
||||||
*parts ? *parts : "", part->index, name,
|
*parts ? *parts : "", part->index, name,
|
||||||
part->type ? part->type : "application",
|
part->type ? part->type : "application",
|
||||||
part->subtype ? part->subtype : "octet-stream",
|
part->subtype ? part->subtype : "octet-stream",
|
||||||
(unsigned)part->size);
|
(unsigned)part->size);
|
||||||
|
|
||||||
|
g_free (*parts);
|
||||||
|
*parts = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -233,10 +237,10 @@ append_sexp_attachments (GString *gstr, MuMsg *msg)
|
||||||
mu_msg_part_foreach (msg, FALSE,
|
mu_msg_part_foreach (msg, FALSE,
|
||||||
(MuMsgPartForeachFunc)each_part, &parts);
|
(MuMsgPartForeachFunc)each_part, &parts);
|
||||||
|
|
||||||
if (parts)
|
if (parts) {
|
||||||
g_string_append_printf (gstr, "\t:attachments (%s)\n", parts);
|
g_string_append_printf (gstr, "\t:attachments (%s)\n", parts);
|
||||||
|
g_free (parts);
|
||||||
g_free (parts);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
#include <math.h> /* for log, ceil */
|
#include <math.h> /* for log, ceil */
|
||||||
#include <string.h> /* for memset */
|
#include <string.h> /* for memset */
|
||||||
|
|
||||||
#include "mu-threader.h"
|
#include "mu-threader.h"
|
||||||
|
@ -173,18 +173,27 @@ find_or_create (GHashTable *id_table, MuMsg *msg, guint docid)
|
||||||
c->docid = docid;
|
c->docid = docid;
|
||||||
return c;
|
return c;
|
||||||
} else {
|
} else {
|
||||||
|
char fakeid[16];
|
||||||
|
static unsigned id = 0;
|
||||||
/* c && c->msg */
|
/* c && c->msg */
|
||||||
/* special case, not in the JWZ algorithm: the
|
/* special case, not in the JWZ algorithm: the
|
||||||
* container exists already and has a message; this
|
* container exists already and has a message; this
|
||||||
* means that we are seeing *another message* with a
|
* means that we are seeing *another message* with a
|
||||||
* message-id we already saw... create this message,
|
* message-id we already saw... create this message,
|
||||||
* and mark it as a duplicate, and a child of the one
|
* and mark it as a duplicate, and a child of the one
|
||||||
* we saw before; use its path as a fake message-id*/
|
* we saw before; use its path as a fake message-id
|
||||||
|
* */
|
||||||
MuContainer *c2;
|
MuContainer *c2;
|
||||||
c2 = mu_container_new (msg, docid, "<dup>");
|
c2 = mu_container_new (msg, docid, "<dup>");
|
||||||
c2->flags = MU_CONTAINER_FLAG_DUP;
|
c2->flags = MU_CONTAINER_FLAG_DUP;
|
||||||
c = mu_container_append_children (c, c2);
|
c = mu_container_append_children (c, c2);
|
||||||
/* don't add it to the id_table */
|
|
||||||
|
/* add the container to the id-table with a
|
||||||
|
* fake-id so it will be freed when the
|
||||||
|
* id_table is destroyed */
|
||||||
|
snprintf (fakeid, sizeof(fakeid), "%x", ++id);
|
||||||
|
g_hash_table_insert (id_table, (gpointer)fakeid, c);
|
||||||
|
|
||||||
return NULL; /* don't process this message further */
|
return NULL; /* don't process this message further */
|
||||||
}
|
}
|
||||||
} else { /* Else: Create a new MuContainer object holding
|
} else { /* Else: Create a new MuContainer object holding
|
||||||
|
|
Loading…
Reference in New Issue