Fix NULL realloc bug.
authorfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Sat, 17 Dec 2005 17:13:08 +0000 (17:13 +0000)
committerfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Sat, 17 Dec 2005 17:13:08 +0000 (17:13 +0000)
git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/doldaconnect@534 959494ce-11ee-0310-bf91-de5d638817bd

clients/gtk2/main.c

index f2407c5..239006c 100644 (file)
@@ -846,7 +846,15 @@ gint ksupdatecb(gpointer data)
        }
     }
     if(oldnum != numspeeds)
-       knownspeeds = srealloc(knownspeeds, numspeeds * sizeof(*knownspeeds));
+    {
+       if(numspeeds == 0)
+       {
+           free(knownspeeds);
+           knownspeeds = NULL;
+       } else {
+           knownspeeds = srealloc(knownspeeds, numspeeds * sizeof(*knownspeeds));
+       }
+    }
     gtk_tree_model_foreach(GTK_TREE_MODEL(srchmodel), ksupdaterow, NULL);
     if(ksqueryseq == -2)
     {