aboutsummaryrefslogtreecommitdiffhomepage
path: root/mime-node.c
diff options
context:
space:
mode:
authorGravatar Austin Clements <amdragon@MIT.EDU>2012-03-06 18:26:57 +0000
committerGravatar David Bremner <bremner@debian.org>2012-03-10 21:25:19 -0400
commit353577ad5733b78b71d93c9bdbaae0b062d32331 (patch)
treece3a4686089f44d2822b2a0d4d7693314f628eb2 /mime-node.c
parent90f310b4fb8903898ead674059584737e448eb8a (diff)
Handle errors in mime_node_open
Diffstat (limited to 'mime-node.c')
-rw-r--r--mime-node.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/mime-node.c b/mime-node.c
index d6b4506c..a95bdabc 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -97,11 +97,26 @@ mime_node_open (const void *ctx, notmuch_message_t *message,
}
mctx->stream = g_mime_stream_file_new (mctx->file);
+ if (!mctx->stream) {
+ fprintf (stderr, "Out of memory.\n");
+ status = NOTMUCH_STATUS_OUT_OF_MEMORY;
+ goto DONE;
+ }
g_mime_stream_file_set_owner (GMIME_STREAM_FILE (mctx->stream), FALSE);
mctx->parser = g_mime_parser_new_with_stream (mctx->stream);
+ if (!mctx->parser) {
+ fprintf (stderr, "Out of memory.\n");
+ status = NOTMUCH_STATUS_OUT_OF_MEMORY;
+ goto DONE;
+ }
mctx->mime_message = g_mime_parser_construct_message (mctx->parser);
+ if (!mctx->mime_message) {
+ fprintf (stderr, "Failed to parse %s\n", filename);
+ status = NOTMUCH_STATUS_FILE_ERROR;
+ goto DONE;
+ }
mctx->cryptoctx = cryptoctx;
mctx->decrypt = decrypt;