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)
|
||||
{
|
||||
const char *fname;
|
||||
char *name;
|
||||
char *name, *tmp;
|
||||
|
||||
|
||||
if (!mu_msg_part_looks_like_attachment (part, TRUE))
|
||||
return;
|
||||
|
@ -215,12 +216,15 @@ each_part (MuMsg *msg, MuMsgPart *part, gchar **parts)
|
|||
else
|
||||
name = g_strdup_printf ("\"part-%d\"", part->index);
|
||||
|
||||
*parts = g_strdup_printf
|
||||
("%s(:index %d :name %s :mime-type \"%s/%s\" :size %u)",
|
||||
*parts ? *parts : "", part->index, name,
|
||||
part->type ? part->type : "application",
|
||||
part->subtype ? part->subtype : "octet-stream",
|
||||
(unsigned)part->size);
|
||||
tmp = g_strdup_printf
|
||||
("%s(:index %d :name %s :mime-type \"%s/%s\" :size %u)",
|
||||
*parts ? *parts : "", part->index, name,
|
||||
part->type ? part->type : "application",
|
||||
part->subtype ? part->subtype : "octet-stream",
|
||||
(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,
|
||||
(MuMsgPartForeachFunc)each_part, &parts);
|
||||
|
||||
if (parts)
|
||||
if (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.
|
||||
**
|
||||
*/
|
||||
#include <math.h> /* for log, ceil */
|
||||
#include <math.h> /* for log, ceil */
|
||||
#include <string.h> /* for memset */
|
||||
|
||||
#include "mu-threader.h"
|
||||
|
@ -173,18 +173,27 @@ find_or_create (GHashTable *id_table, MuMsg *msg, guint docid)
|
|||
c->docid = docid;
|
||||
return c;
|
||||
} else {
|
||||
char fakeid[16];
|
||||
static unsigned id = 0;
|
||||
/* c && c->msg */
|
||||
/* special case, not in the JWZ algorithm: the
|
||||
* container exists already and has a message; this
|
||||
* means that we are seeing *another message* with a
|
||||
* message-id we already saw... create this message,
|
||||
* 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;
|
||||
c2 = mu_container_new (msg, docid, "<dup>");
|
||||
c2->flags = MU_CONTAINER_FLAG_DUP;
|
||||
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 */
|
||||
}
|
||||
} else { /* Else: Create a new MuContainer object holding
|
||||
|
|
Loading…
Reference in New Issue