qulogic/libgnt

Fix possible use-of-NULL or invalid pointers.

2019-10-02, Elliott Sales de Andrade
9181386790d8
Parents d61c212123f5
Children ba0a1cf21c46
Fix possible use-of-NULL or invalid pointers.
  • +7 -5
    gntbox.c
  • +1 -2
    gntentry.c
  • --- a/gntbox.c Wed Oct 02 02:02:37 2019 -0400
    +++ b/gntbox.c Wed Oct 02 02:04:21 2019 -0400
    @@ -309,11 +309,13 @@
    gpointer last = priv->active;
    do
    {
    - GList *iter = g_list_find(priv->focus, priv->active);
    - if (iter && iter->next) {
    - priv->active = iter->next->data;
    - } else if (priv->focus) {
    - priv->active = priv->focus->data;
    + if (priv->focus) {
    + GList *iter = g_list_find(priv->focus, priv->active);
    + if (iter && iter->next) {
    + priv->active = iter->next->data;
    + } else {
    + priv->active = priv->focus->data;
    + }
    }
    if (gnt_widget_get_visible(priv->active) &&
    gnt_widget_get_take_focus(priv->active)) {
    --- a/gntentry.c Wed Oct 02 02:02:37 2019 -0400
    +++ b/gntentry.c Wed Oct 02 02:04:21 2019 -0400
    @@ -1202,8 +1202,6 @@
    int len;
    int scroll, cursor;
    - g_free(priv->start);
    -
    if (text && text[0])
    {
    len = strlen(text);
    @@ -1218,6 +1216,7 @@
    scroll = priv->scroll - priv->start;
    cursor = priv->end - priv->cursor;
    + g_free(priv->start);
    priv->start = g_new0(char, priv->buffer);
    if (text) {
    snprintf(priv->start, len + 1, "%s", text);