Python plugin: const fix
authorHolger Berndt <hb@claws-mail.org>
Sun, 7 Apr 2013 14:29:40 +0000 (16:29 +0200)
committerHolger Berndt <hb@claws-mail.org>
Sun, 7 Apr 2013 22:49:23 +0000 (00:49 +0200)
It seems a bit strange for procheader_get_header_from_msginfo()
to require a non-const header string argument, though.

src/plugins/python/messageinfotype.c

index a46c6315d80acf4ab1872b003ae7b961b0a7a22f..766b29a1d69ed1c09167cc7cebede98d065db7af 100644 (file)
@@ -216,6 +216,7 @@ static PyObject* get_header(PyObject *self, PyObject *args)
 {
   int retval;
   const char *header_str;
+  char *header_str_dup;
   MsgInfo *msginfo;
   gchar header_content[HEADER_CONTENT_SIZE];
 
@@ -225,7 +226,10 @@ static PyObject* get_header(PyObject *self, PyObject *args)
 
   msginfo = ((clawsmail_MessageInfoObject*)self)->msginfo;
 
-  if(procheader_get_header_from_msginfo(msginfo, header_content, HEADER_CONTENT_SIZE, header_str) == 0) {
+  header_str_dup = g_strdup(header_str);
+  retval = procheader_get_header_from_msginfo(msginfo, header_content, HEADER_CONTENT_SIZE, header_str);
+  g_free(header_str_dup);
+  if(retval == 0) {
     PyObject *header_content_object;
     gchar *content_start;