> +     gint  numlines;         // number of lines in **lines array
> +     gchar *newfile;         // *final* string to replace current document
> +     gint  nfposn;           // keeps track of the position of newfile string
> +     gint  i;                // iterator
> +     gint  j;                // iterator
> +     gint  k;                // iterator
> +
> +     totalnumchars = sci_get_length(doc->editor->sci);
> +     totalnumlines = sci_get_line_count(doc->editor->sci);
> +     lines         = g_malloc(sizeof(gchar *) * totalnumlines);
> +     newfile       = g_malloc(sizeof(gchar) * (totalnumchars+1));
> +     numlines      = 0;
> +     nfposn        = 0;
> +     k             = 0;
> +
> +     if(newfile && lines)    // verify memory allocation

`g_malloc()` aborts on failure.  If you really mean to support allocation 
failure you need to use `g_try_malloc()` instead (no need unless you allocate 
really large data, as on very low memory situations something in GLib/GTK/Geany 
will most likely abort anyway).

---
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/pull/324/files#r49270637

Reply via email to