1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

Fix possible issue with uninitialized data

This commit is contained in:
Dave Davenport 2015-12-21 23:14:56 +01:00
parent 6760453d80
commit 8b82787df6
2 changed files with 3 additions and 3 deletions

View file

@ -213,7 +213,7 @@ static void get_apps ( DRunModePrivateData *pd )
}
const char *d = g_get_user_data_dir ();
for ( size_t i = 0; dr[i] != NULL; i++ ) {
for ( size_t i = 0; dr && dr[i] != NULL; i++ ) {
if ( g_strcmp0 ( d, dr[i] ) == 0 ) {
// Done this already, no need to repeat.
return;

View file

@ -174,13 +174,13 @@ static int lev_sort ( const void *p1, const void *p2, void *arg )
#define MIN3( a, b, c ) ( ( a ) < ( b ) ? ( ( a ) < ( c ) ? ( a ) : ( c ) ) : ( ( b ) < ( c ) ? ( b ) : ( c ) ) )
static int levenshtein ( const char *s1, const char *s2 )
static unsigned int levenshtein ( const char *s1, const char *s2 )
{
unsigned int x, y, lastdiag, olddiag;
size_t s1len = strlen ( s1 );
size_t s2len = strlen ( s2 );
unsigned int column[s1len + 1];
for ( y = 1; y <= s1len; y++ ) {
for ( y = 0; y <= s1len; y++ ) {
column[y] = y;
}
for ( x = 1; x <= s2len; x++ ) {