Skip to content
Snippets Groups Projects
Commit 05836550 authored by gb10's avatar gb10
Browse files

Fixed a couple of potential memory bugs

parent 38a599c4
No related branches found
No related tags found
No related merge requests found
......@@ -459,6 +459,16 @@ void showDotterDialog(GtkWidget *blxWindow, const gboolean bringToFront)
/* Create the dialog data struct first time round, but re-populate it each time. Create
* a destructor function that will free the struct. */
dialogData = g_malloc(sizeof(DotterDialogData));
dialogData->blxWindow = NULL;
dialogData->autoButton = NULL;
dialogData->manualButton = NULL;
dialogData->startEntry = NULL;
dialogData->endEntry = NULL;
dialogData->zoomEntry = NULL;
dialogData->callOnSelf = FALSE;
dialogData->hspsOnly = FALSE;
dialogData->dotterSSeq = NULL;
g_signal_connect(G_OBJECT(dialog), "destroy", G_CALLBACK(onDestroyDotterDialog), dialogData);
g_signal_connect(dialog, "response", G_CALLBACK(onResponseDotterDialog), dialogData);
......@@ -532,6 +542,13 @@ void showDotterDialog(GtkWidget *blxWindow, const gboolean bringToFront)
dialogData->zoomEntry = zoomEntry;
dialogData->callOnSelf = FALSE;
dialogData->hspsOnly = FALSE;
if (dialogData->dotterSSeq)
{
g_free(dialogData->dotterSSeq);
dialogData->dotterSSeq = NULL;
}
dialogData->dotterSSeq = getDotterSSeq(blxWindow, NULL);
/* There is an issue if the user selects a different sequence while the dotter dialog
......
......@@ -5199,8 +5199,11 @@ static void calcID(MSP *msp, BlxViewContext *bc)
int sIdx = s_start, qIdx = q_start ;
while (((sForward && sIdx < sRangeMax) || (!sForward && sIdx >= sRangeMin - 1)) && qIdx < qLen)
{
if (toupper(matchSeq[sIdx]) == toupper(refSeqSegment[qIdx]))
numMatchingChars++ ;
/* Check that qIdx is not less that 0, which could happen if we have somehow got duff data. */
if (qIdx >= 0 && toupper(matchSeq[sIdx]) == toupper(refSeqSegment[qIdx]))
{
numMatchingChars++ ;
}
/* Move to the next base. The refSeqSegment is always forward, but we might have to
* traverse the s sequence in reverse. */
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment