Open bsdinis opened 5 years ago
when calling S3_get_object when the key in question doesn't exist in bucket, valgrind reports a bunch of conditional jumps on unitialized values and a leak.
example program
#include <stdio.h> #include "libs3.h" static S3Status getObjectDataCallback(int bufferSize, const char *buffer { FILE *outfile = (FILE *) callbackData; if (bufferSize <= 0) return S3StatusOK; size_t wrote = fwrite(buffer, 1, bufferSize, outfile); return ((wrote < (size_t) bufferSize) ? S3StatusAbortedByCallback : S3 } int s3_get(const char * key, FILE * stream) { S3GetObjectHandler getObjectHandler = { responseHandler, &getObjectDataCallback }; S3_get_object( &bucketContext, key, NULL, 0, 0, NULL, 0, &getObjectHandler, stream ); return 0; } int main(int argc, char ** argv) { if (argc != 2) { fprintf(stderr, "usage: %s key\n", argv[0]); return -1; } S3_initialize(NULL, S3_INIT_ALL, host); s3_get(argv[1], stdout); S3_deinitialize(); return 0; }
when calling S3_get_object when the key in question doesn't exist in bucket, valgrind reports a bunch of conditional jumps on unitialized values and a leak.
example program