src/filesystem/nacl/SDL_sysfilesystem.c
author Philipp Wiesemann <philipp.wiesemann@arcor.de>
Wed, 29 Oct 2014 20:20:47 +0100
changeset 9201 21d9f9babb30
parent 8878 f7ba2119fd91
child 9327 3644013ad914
permissions -rw-r--r--
Fixed bug 2647 - Memory leak in SDL_AddHintCallback function - SDL_hints.c

Nitz

Variable entry going out of scope leaks the storage it points to, at:

/* Need to add a hint entry for this watcher */
hint = (SDL_Hint *)SDL_malloc(sizeof(*hint));
if (!hint) {
return;
}

Patch is attached.
gabomdq@8851
     1
/*
gabomdq@8851
     2
  Simple DirectMedia Layer
gabomdq@8851
     3
  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
gabomdq@8851
     4
gabomdq@8851
     5
  This software is provided 'as-is', without any express or implied
gabomdq@8851
     6
  warranty.  In no event will the authors be held liable for any damages
gabomdq@8851
     7
  arising from the use of this software.
gabomdq@8851
     8
gabomdq@8851
     9
  Permission is granted to anyone to use this software for any purpose,
gabomdq@8851
    10
  including commercial applications, and to alter it and redistribute it
gabomdq@8851
    11
  freely, subject to the following restrictions:
gabomdq@8851
    12
gabomdq@8851
    13
  1. The origin of this software must not be misrepresented; you must not
gabomdq@8851
    14
     claim that you wrote the original software. If you use this software
gabomdq@8851
    15
     in a product, an acknowledgment in the product documentation would be
gabomdq@8851
    16
     appreciated but is not required.
gabomdq@8851
    17
  2. Altered source versions must be plainly marked as such, and must not be
gabomdq@8851
    18
     misrepresented as being the original software.
gabomdq@8851
    19
  3. This notice may not be removed or altered from any source distribution.
gabomdq@8851
    20
*/
gabomdq@8851
    21
#include "../../SDL_internal.h"
gabomdq@8851
    22
#include "SDL_error.h"
gabomdq@8851
    23
#include "SDL_filesystem.h"
gabomdq@8851
    24
gabomdq@8851
    25
#ifdef SDL_FILESYSTEM_NACL
gabomdq@8851
    26
gabomdq@8851
    27
char *
gabomdq@8851
    28
SDL_GetBasePath(void)
gabomdq@8851
    29
{
gabomdq@8851
    30
    SDL_Unsupported();
gabomdq@8851
    31
    return NULL;
gabomdq@8851
    32
}
gabomdq@8851
    33
gabomdq@8851
    34
char *
gabomdq@8851
    35
SDL_GetPrefPath(const char *org, const char *app)
gabomdq@8851
    36
{
gabomdq@8851
    37
    SDL_Unsupported();
gabomdq@8851
    38
    return NULL;
gabomdq@8851
    39
}
gabomdq@8851
    40
gabomdq@8851
    41
#endif /* __NACL__ */